Runtime Error 91

paulsolar

Well-known Member
Joined
Aug 21, 2013
Messages
691
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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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,223,885
Messages
6,175,184
Members
452,615
Latest member
bogeys2birdies

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