All Questions

122
votes
10answers
74702 views

Error in finding last used cell in VBA

When I want to find the last used cell value, I use: Dim last_row As Integer Dim LastRow As Long LastRow = Range("E4:E48").End(xlDown).Row Debug.Print LastRow I am getting the wrong output when ...
358
votes
6answers
490721 views

How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops

How can I use regular expressions in Excel and take advantage of Excel's powerful grid like setup for data manipulation? In-cell function to return matched pattern or replaced value in string. Sub t...
161
votes
5answers
433886 views

Loop through files in a folder using VBA?

I would like to loop through the files of a directory using vba in Excel 2010. In the loop, I will need the filename, and the date at which the file was formatted. I have coded the following wh...
26
votes
2answers
28698 views

MS Excel crashes when vba code runs

I am having a problem with excel crashing when i run VBA code on an excel sheet. I have some code to add a formula to a range of cells as follows: Private Sub Worksheet_Change(ByVal Target As Range) ...
28
votes
5answers
30390 views

Why Use Integer Instead of Long?

I often see questions relating to Overflow errors with vba. My question is why use the integer variable declaration instead of just defining all numerical variables (excluding double etc.) as long? ...
20
votes
3answers
54275 views

Excel VBA, getting range from an inactive sheet

This script works fine when I'm viewing the "Temp" sheet. But when I'm in another sheet then the copy command fails.. It gives a "Application-defined or object-defined error" Sheets("Temp").Range(Cel...
205
votes
9answers
211037 views

Does VBA have Dictionary Structure?

Does VBA have dictionary structure? Like key<>value array?
48
votes
2answers
2956 views

Using a UDF in Excel to update the worksheet

Not really a question, but posting this for comments because I don't recall seeing this approach before. I was responding to a comment on a previous answer, and tried something I'd not attempted befo...
102
votes
11answers
221810 views

Microsoft Excel ActiveX Controls Disabled?

I have some Excel worksheets that use ActiveX checkboxes to control certain activity. They worked recently but today started to give errors. I was alerted to this by a colleague, but it was still wo...
73
votes
3answers
251454 views

How do I use FileSystemObject in VBA?

Is there something that I need to reference? How do I use this: Dim fso As New FileSystemObject Dim fld As Folder Dim ts As TextStream I am getting an error because it does not recognize these obje...

Previous Next