range.select error??

aceee

Board Regular
Joined
Feb 21, 2008
Messages
239
hey all

I have this:

Code:
Private Sub CommandButton1_Click()
Worksheets("Sheet1").Activate
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
ActiveCell.PasteSpecial
End Sub

it errors to: SELECT METHOD OR RANGE CLASS FAILED

any idea?
 
this is really confusing.. now i'm getting the error again on:

Code:
    Sheets("Stock").Range("L1").Copy 'Selection.Copy
    Sheets("Stock").Range("L2:L296").Paste
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Do you want to go through every syntax that you can think of....?
Silly...
Paste method is a Sheet class method.
Find the way for yourself since I have already posted the solution.
 
Upvote 0
i really do appreciate your help...

just frustrating me that i can't understandit....

the command i entered above, is the same as the one you suggested on the previous page is it not?
 
Upvote 0
I suspect you had a similar problem as you had initially with these lines:
Code:
Sheets("Sheet2").Select
Range("A1").Select
where your range("A1") does not have a sheet specified.

Also, the With statement only saves you some typing - instead of:
Code:
Sheets("Sheet2").Select
Sheets("Sheet2").Range("A1").Select
where you repeat the Sheets("Sheet2") part, you can use:
Code:
With Sheets("Sheet2")
    .Select
    .Range("A1").Select
End With
but you don't have to - it works either way. The With statement is just a bit neater, especially if you refer to the same object several times.
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,220
Members
448,554
Latest member
Gleisner2

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