rjplante
Well-known Member
- Joined
- Oct 31, 2008
- Messages
- 567
- Office Version
- 365
- Platform
- Windows
I have an macro and it is failing on the last line in the code block. The worksheet that this is searching on does contain the text system options. When I select column A and perform a find for that text, it finds the exact row just fine. Yet when I run my macro, it fails on this line with a run time error 91 - Object Variable or With block variable not set. I have the range declared up above, so I don't know what the issue is. I have a second macro that executes a similar function and fails in the same manner (macro 2) with the last line failing to find the text. Why is the system unable to execute a find? The file is saved as .xlsm format so all of the macros should be working. I am confused...
Macro 1:
Macro 2:
Macro 1:
VBA Code:
Dim FindRow As Range
With Sheets("Pricing Sheet")
Set FindRow = .Range("A:A").Find(What:="System Options", LookIn:=xlValues, LookAt:=xlWhole)
End With
Sheets("Pricing Sheet").Range("A" & FindRow.Row + 1).Select
Macro 2:
VBA Code:
Dim newLrow As Long
Dim GrandTotal As Range
With Sheets("Component List")
Set GrandTotal = .Range("A:A").Find(What:="SYSTEM TOTAL", LookIn:=xlValues, LookAt:=xlWhole)
End With
newLrow = GrandTotal.Row