VBA (Visual Basic for Applications) is the dominant programming language for Microsoft Office Applications [Word, Excel, Access...].

learn more… | top users | synonyms

0
votes
0answers
7 views

Create a range from multiple cells

I want to create a range from multiple cells. Something like this: I would like to have the following 4 cells: Cells(4, 7) Cells(4, 8) Cells(8, 7) Cells(8, 8) to be extracted from a file and ...
0
votes
0answers
9 views

VBA code to copy activex control with its code

On workbook "A" I have a command button with a code behind the button. I want to copy the command button and its code to another workbook "B" It should be done using VBA code. The command button is to ...
0
votes
0answers
11 views

handle an Array built from row count when rows equals one Excel 2000 VBA

I Apologize for being long winded and sorry for not knowing how to display sheet info. My skills are still very rudimentary. For better or worse this code works. Except when there is only one item ...
0
votes
0answers
16 views

Macros im getting object doesn't support this property or method error

I tried to run a macro to connect sql from excel to download the data from sql tables. I used the below code. Im getting the error "object doesn't support this property or method" Sub ...
-3
votes
0answers
18 views

To find specific value among 3000 values in column in VBA [on hold]

I have some values among 3000 rows and i have to find the 0 (specific) value among 3000 rows and in another sheet, the different categories used to link with the values which already found, this is ...
0
votes
0answers
12 views

Runge Kutta 4 With Adaptive Step sizing - Have a base code, not sure where to include the adaption part

I have most of the runge-kutta 4 with adaptive step sizing figured out, but I am unsure about two things. The first being incorporating the stepsizing into the functions I already have, when I provide ...
-1
votes
1answer
22 views

Excel Web Query Show Full HTML Code

Does anyone have a way that I can use a web query (or another automated VBA way) to import the full html code of a page into an excel page? I need just about everything from <body> to ...
0
votes
1answer
10 views

How do I randomly select an integer from an array, that excludes each previous selection?

I'm trying to make a set box of cells populate in a random appearing order. I have it just running through way more iterations than necessary so that the entire box populates. I wish to exclude ...
0
votes
0answers
28 views

VBA excel For each row in table match cell in spreadsheet with cell in webpage table

This is kind of a repost to reorganize my question but: I'm trying to match my spreadsheets cell B1 text with all the cells in the 10th column of a table on a webpage. If theres a match, I want to ...
0
votes
1answer
25 views

Why is VBA saying that it has found an 'ambiguous name'?

When compiling some code (declarations shown below) I get the error message 'Compile Error: Ambiguous name detected. SixTables'. I have looked here and elsewhere but cannot find anything that matches ...
0
votes
1answer
19 views

How to reference a value to a range of numbers in another list then have values returned from 2 different places where the value is found

I hope my title made some sense. In essence I am trying to do this with very little programming experience and I understand now that I very much need help. I have been attempting to use Visual Basic ...
0
votes
0answers
29 views

Checkboxes with cell data

I am working on a UserForm in Excel 2010 and am trying to generate a check box for each populated cell in a range. I'm not sure If I would need a list box also or how to do this. As each box is ...
0
votes
0answers
10 views

Excel-REST Web Service call to show up in Fiddler

I use the Excel-REST implementation from Tim Hall. Github: Excel-REST This works perfectly for my purpose, but I would like to capture the Traffic in Fiddler for Detail analysis. I used the ...
1
vote
4answers
42 views

How can I optimise a set of VBA functions that parse String and Variant types

How can I optimise these functions? They work but I need it to be much faster. Actual working (slow): Function IsInArray(value As String, arr As Variant) As Boolean Dim length As Integer ...
1
vote
1answer
44 views

Most efficient way to add cell values across congruent ranges in VBA?

I need to sum the values two ranges of arbitrary (but identical) sizes. A1 in input1 gets summed with A1 in input2, then output to A1 in the output cell, etc. I need the end values, not formulas or ...
0
votes
1answer
30 views

VBA code in Excel to add a row to multiple sheets and then copy formula from adjacent row

I'm really hoping someone can help me with this one. I have recorded a macro to use within a sheet that needs to create a row at the same position on 2 worksheets and then, on one of them, copy the ...
0
votes
0answers
25 views

I cannot seem to use the appropriate range in my VBA script that is trying to refresh a workbook

Here is my script: Sub RefreshAllData () Worksheets("Overconcentration").Select Range("H1").Select Selection.QueryTable.Refresh BackgroundQuery:=False End Sub I am attempting to refresh data ...
0
votes
1answer
28 views

Change Connection String via code [on hold]

I have 9 sheets that connect to different tables in teradata, each time i have to enter my user name and password to refresh and get new set of data. could someone please advice how do i write a VBA ...
0
votes
1answer
32 views

Macro incorrectly deleting table lines

I've got a macro that I run to add lines to a table, this information comes from a sql database. My problem is, when I step through the macro it works absolutely fine and does exactly what it's ...
0
votes
0answers
21 views

How to call VBA macro from AHK in Excel when editing a cell?

I have an autohotkey script which calls an Excel macro. Basically I have a universal shortcut to add a task to my custom GTD application in Excel My AHK code is as follows: ...
0
votes
1answer
37 views

Construct year-month-day hour:min:sec from encoded string

I have in a cell the following value 07DD0B190C3A00 I know that: 07DD is the year 2013 0B is the month November 19 is the date 25th OC is the hour Noon 3A are the ...
0
votes
1answer
16 views

How to download excel attachment with the subject ending with a specific text and then open the attachment for editing?

I want to download an attachment from Outlook 2010. The subject of the mail containing the attachment keeps changing. The subject names are in the following format: "2010 (random name) Sigma Report" ...
0
votes
2answers
32 views

How to copy only a single worksheet to another workbook using vba

I have 1 WorkBook("SOURCE") that contains around 20 Sheets. I want to copy only 1 particular sheet to another Workbook("TARGET") using Excel VBA. Please note that the "TARGET" Workbook doen't exist ...
1
vote
1answer
35 views

Lock a cell if the adjacent cell is empty - Excel VBA

What I want to get is that if a cell in the range "D4: D14" is empty, the adjacent cell is locked. My code is the following but it doesn´t work: Private Sub Worksheet_Change(ByVal Target As Range) ...
0
votes
1answer
23 views

Controlling filter from VBA

I've got a filter in an Excel sheet. One of the columns in the filter contains dates. I would like to be able to control the filter via VBA so I can configure what rows should be shown based on ...
1
vote
1answer
15 views

VBA return sum of range values from different workbook

I am trying to use VBA in an excel sheet (lets call it wbA) to find the sum of the values in a range of cells in another workbook (lets call that wbB). I have tried using a custom made summing ...
0
votes
1answer
37 views

how to write vba code for selecting rows from a sheet?

I am a beginner in vba...i am doing a task which consist of 6 sequences.. Sequence 1 Sequence 2 Sequence 3 Sequence 4 Sequence 5 Sequence 6 In sheet-1 i have done all the ...
0
votes
1answer
20 views

Using VLOOKUP referencing another sheet in VBA excel 2007

I know many questions have been both asked and answered around this subject, but I couldn't find anything that worked for me as I'm referencing another sheet (Lookuptable). Below is the original ...
0
votes
1answer
22 views

Using an Excel UDF inside another UDF

Is is possible to use one UDF inside another? For example Columns A,B,C,D. UDF1(w,x) - Calculates the product of the maximum of A and the Maximum of BUDF2(y,z) - Calculates the product of the ...
2
votes
2answers
22 views

Concatenating and iterating through multiple Cells VBA excel

I want to iterate through data (simular to that shown below) that is stored in different cells and combine them into a single cell seperated by a new line (chr(10)). The amount of data that needs to ...
0
votes
1answer
10 views

Get range identifier from range object excel vba

I have some VBA code that works on named ranges that are set up externally. How can I get the actual cell reference from this range? For example Dim rangeID As String rangeID = ...
1
vote
1answer
14 views

Close userform with escape button

I have 2 questions. When I pressed esc button then close Userform1 When I input open in TextBox1 then Userform2 should show. Also clear TextBox1 in Userform1 automatically. I have tried the below ...
0
votes
1answer
27 views

Re-paste matrix to other matrix

I am a complete newbie with VBA, but I have few thousand lines of data in the file and I presume that a macro is the only possible solution to my problem. Here is an illustration of my problem: I ...
0
votes
0answers
42 views

While loop fails

I'm writing a loop that should copy a few cells to a different row every time a button is clicked in a form. I've only succeeded in copying them the first time. when the second button is clicked, it ...
0
votes
0answers
36 views

How to create a loop that inserts rows based on some conditions

I am trying to create a Loop in Excel which will go through Column B rows 28 to 47. In the cells of column B, from row 28 to 47, will be numbers 1 to 20. I am trying to create a loop which will go ...
0
votes
0answers
12 views

Java Read values from Excel Macro userform

I have a excel which loads a Macro userform on open. I need to open this excel and read the values from a textbox in that userform through Java. I have tried using Jacob API. Im able to get values ...
0
votes
1answer
10 views

Syntax to loop through a range of cells and change a cell value

Currently, cell B2 contains a number that gets referenced when using Solver to generate a certain output. Different values in B2 would generate different values, and I am trying to create code that ...
0
votes
1answer
54 views

How to write if function for more than one row on website table HTML

DataGridReservations is a table. I am running a search by row. My VBA works for one row. Is Is there a way to loop this VBA code to search each row in the table? Maybe by increasing the Item(2) in ...
0
votes
0answers
22 views

Copy from email to excel

I'm not an expert in VBA, got an error which I can't figure out, can you please help advise? I need an excel macro to copy from all the emails in a folder to my excel, googled and found the below ...
1
vote
1answer
24 views

Trying to combine INDEX and MATCH functions in VBA

Why doesn't this work? Result = Application.WorksheetFunction.Index((Range("CountryNames")), _ Application.Match((Range("B61")), (Range("CurrencyValues")), 0))
0
votes
1answer
16 views

Search for cells missing specified text and then add it

I have an Excel spreadsheet with alphanumeric entries in Column A. All entries should have the same six digit ending but some don't. I found a macro that adds specific text to the end of each cell ...
2
votes
1answer
27 views

Range.End() Confuzzlement

I have a general question regarding the Range.End() property in VBA. I've read up on the property here, but I'm still confused. Example: With ws lastRow = .Cells(.Rows.Count, ...
1
vote
0answers
20 views

Is the versions 12 vs 14 Object Library causing Excel VBA “Code execution has been halted”?

I have an Excel 2007 running the 12 Object Library. The macros run fine when opening the workbook in Excel 2007. However, there is a “Code execution has been halted” message whenever the macros are ...
1
vote
1answer
24 views

Checking to see if SaveAs was successful VBA

What kind of statement do I need to check whether or not a SaveAs operation was successful in vba? Sub saveBookAs() wb.SaveAs fileName:="newFile" End Sub
4
votes
3answers
38 views

How can I create one hyperlink to each worksheet in one index sheet?

Edit: After doing a bit more research I stumbled on this handy little shortcut: Just right click on the little arrows on the bottom left corner to show all sheets - no code required! I have an ...
0
votes
1answer
34 views

Yet another Excel VBA 404 error

I want this script to check the cells on column A if there is a URL-link in them, and if it is true then perform some cut-paste operations. String #5 returns error 404, please help to solve this! ...
2
votes
1answer
12 views

Specify Sequence of actions in Macro?

I've written a series of macro's in a worksheet that work sequentially to download data through api and subsequently analyze and format the data. My goal is to combine the six command buttons into ...
0
votes
0answers
39 views

VBA to use spreadsheet cell to reference specific row in HTML table

Stuck again =/ There's a table on a webpage with information that I'm writing something in VBA to pull and put into my excel spreadsheet. My VBA is referencing my A1 data on my spreadsheet and ...
0
votes
1answer
30 views

overflow error---loop does not converge in function

'I want to call this function dpdxf in a main program with following constants, but it stops during first iteration giving a -ve value of dpdxf. Bust dpdxf always should be >0 or positive. ...
1
vote
2answers
32 views

Excel VBA - Combine rows with duplicate values in one cell and merge values in other cell

I am trying to find duplicate values in one column and combine the values of a second column into one row. I also want to sum the values in a third column. For example: A B C D h 4 w ...

15 30 50 per page