Runtime Error 91

paulsolar

Well-known Member
Joined
Aug 21, 2013
Messages
684
Office Version
  1. 365
Hi All

I need a bit of assistance please, I'm getting a Runtime Error 91 "Object variable or with block variable not set" form the code below. Could you take a look and see what I'm missing please.

Kind regards

Paul

VBA Code:
Sub get_promotions()

With Sheets("Import Sheet")
Set findrow = .Range("A:A").Find(What:="Section 9 Claims History", LookIn:=xlValues)
End With
Dim findRowNumber As Long
findRowNumber = findrow.Row

Dim lastrow9 As Long
lastrow9 = Sheets("Import Sheet").Cells(Sheets("Import Sheet").Rows.Count, "A").End(xlUp).Row

Sheets("Import Sheet").Range("A" & findRowNumber + 1 & ":I" & lastrow9 + 1).Copy Destination:=Sheets("Promotion Claims History").Range("A1")

End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
May be it found nothing from the find method.
try to add
PHP:
.....
Dim findRowNumber As Long
If findRow is Nothing then Exit sub
findRowNumber = findrow.Row
.....
 
Upvote 0
Hi, you are an absolute star,

Who ever typed in the data in originally added a space before the name and it wasn't finding it. I didnt notice this

:sleep:
 
Upvote 0

Forum statistics

Threads
1,215,274
Messages
6,123,993
Members
449,137
Latest member
abdahsankhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top