Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default runtime error 1004

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime error '1004' application or object defined error Janis Excel Programming 4 November 18th 09 03:01 PM
runtime error '1004' application or object defined error. Please help deej Excel Programming 0 August 1st 07 09:26 AM
runtime 1004 error Janis Excel Programming 3 September 14th 06 08:09 PM
Runtime error 1004 HHHH Excel Programming 0 July 6th 06 12:30 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM


All times are GMT +1. The time now is 06:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"