runtime error 1004

G

Guest

hi,

i have the following code behind a button in sheet1:
sheets("pivot").select
range("F2").select

but when i click the button in get the following message:
runtime error 1004: select method of range clas failed.

i did a small test to place the code and button in the same worksheet as the
range (pivot sheet), and it worked just fine.
 
G

Guest

Code in a sheet always refers to that sheet unless otherwise specified. So
your code select the pivot sheet but then it tries to select range F2 on
itself (sheet 1). Try this..

with sheets("pivot")
.select
.range("F2").select
end with
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top