Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 11916

Visual Basic for Applications (VBA) is an event-driven programming language first introduced by Microsoft in 1993 to give Excel 5.0 a more robust object-oriented language for writing macros and automating the use of Excel. It is now used for the entire Office suite and over 200 non-Office hosts.

3 votes
1 answer
3k views

Looping through arrays in VBA

I supplied the following code as an answer to this question on SO, but I was wondering if there was a better way to write out all those array loops (i.e. perhaps using a Collection/Dictionary?) It see …
Gaffi's user avatar
  • 426
6 votes
2 answers
12k views

Multiple nested If checks in VBA

The below code is real and in use, but I've modified it to simplify the process/make it easier to explain. The purpose of this code is to combine data from multiple data sources. All sources are .x …
Gaffi's user avatar
  • 426
3 votes
Accepted

Looping through arrays in VBA

This is the final result of what was done with this code, though the code pertaining to the root question remained unchanged. Function ContainsWhatMonths(OriginalStartDate As String, _ OriginalEn …
Gaffi's user avatar
  • 426
3 votes

Improving performance of VBA batch scripts?

Do you have anything 'fancy' in your sheet? (i.e. special formatting, pivots, formulas?) If not -- or even if you do, but with more work -- you should be able to copy the values into Sheet1 and rename …
Gaffi's user avatar
  • 426
2 votes

Merging worksheets and using find/replace

Not for efficiency, but you can start with this... Convert this block: If FindString(wb.Name, "Report2") Then wb.Worksheets.Move after:=Workbooks("CompanyBook.xlsm").Sheets("Aggregate") ElseIf Fi …
Gaffi's user avatar
  • 426
4 votes
Accepted

Multiple criterias in a VLOOKUP in Excel VBA

Here's a different version, though I won't claim that it is significantly better. The code seemed to work just fine and was mostly easy to understand (see my comment on the original question). My only …
Gaffi's user avatar
  • 426