Method Range of Object'_Global Failed Error Message

spyldbrat

Board Regular
Joined
May 5, 2002
Messages
211
Office Version
  1. 365
Hello, I am getting the above error message on the code below. The debugger is showing me the second to last line is where the issue is ( Range("b9:b" & UsdRws).FillDown) but I can't figuire out what is wrong.

Sub FB()

Rows("7:7").Select
Selection.AutoFilter
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("B7").Select
ActiveCell.FormulaR1C1 = "Finance Book"
Range("B9").Select
ActiveCell.FormulaR1C1 = _
"=IFERROR(VLOOKUP(RC[1],Ad_Hoc!C[-1]:C,2,FALSE),"" "")"
Dim Last_Row As Long
Range("b9:b" & UsdRws).FillDown

End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You haven't given UsdRws as value, therefore you are trying to fill down from B9 to B0
 
Upvote 0
Do you want to copy the formula down to the last row of data?
 
Upvote 0
Try
Code:
Sub FB()
Dim UsdRws As Long
UsdRws = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).row
Rows("7:7").Select
Selection.AutoFilter
Columns("B:B").Select
Selection.Insert Shift:=xlToRight
Range("B7").Select
ActiveCell.FormulaR1C1 = "Finance Book"
Range("B9").Select
ActiveCell.FormulaR1C1 = _
"=IFERROR(VLOOKUP(RC[1],Ad_Hoc!C[-1]:C,2,FALSE),"" "")"
Range("b9:b" & UsdRws).FillDown

End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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