View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default runtime error 1004

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
--
HTH...

Jim Thomlinson


"geebee" wrote:

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.