Select Method of Range Class Failed

SBF12345

Well-known Member
Joined
Jul 26, 2014
Messages
614
At the top of the script I have this

Code:
Dim wb1 As WorkbookDim wb4 As Workbook


Set wb1 = Workbooks("General_Account_Ledger.xls")
Set wb4 = ActiveWorkbook

then later I have this

Code:
wb4.Sheets("Customer Funds Received").Range("B10").Copy        wb1.Sheets("General Ledger").Range("A1").Select
        Selection.End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues

and I receive a "Select Method of Range Class Failed" error on line

Code:
 wb1.Sheets("General Ledger").Range("A1").Select

I am not totally sure why. If I thought it was a missing bracket or something I wouldn't be posting. Perhaps an error in the way I set the variable wb1?
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
When switching between workbooks and sheets, you need to activate them first, i.e.
Code:
wb4.Sheets("Customer Funds Received").Range("B10").Copy
wb1.Activate
Sheets("General Ledger").Activate
Range("A1").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlPasteValues
 
Upvote 0
Again, if you fully qualify your workbook/worksheet/range objects, there is absolutely no need to select anything. In fact, again, selecting objects is not recommended.
 
Upvote 0

Forum statistics

Threads
1,203,600
Messages
6,056,205
Members
444,850
Latest member
dancasta7

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