Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select method of range class failed, Run time error 1004


I have a large amount of data (over 500,000 rows) so I have spread thi
data over multiple sheets. The code I have written has to find record
that match certain criteria and does this by looping through cells
However, when it reaches the bottom of the first sheet (row 65536)
need it to start on the next sheet but I keep getting a Run time error
Here is the bit of code....

If ActiveCell.Row = 65536 And ActiveSheet.Index < 9 Then
g3000SheetNumber = ActiveSheet.Index + 1
Sheets(g3000SheetNumber ).Activate
Cells(1, 1).Select

It manages to select the new sheet but when I try to select the firs
cell of the sheet it throws the error. Can anyone help please?

--
smit12
-----------------------------------------------------------------------
smit127's Profile: http://www.excelforum.com/member.php...fo&userid=2687
View this thread: http://www.excelforum.com/showthread.php?threadid=40108

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Select method of range class failed, Run time error 1004

What is the error message? Subscript out of range? Are you already on the
last sheet when you get the error? (i.e. are there less than 9 sheets?)
Your "End IF" statement is missing. Are there more lines of code before the
End If?

"smit127" wrote:


I have a large amount of data (over 500,000 rows) so I have spread this
data over multiple sheets. The code I have written has to find records
that match certain criteria and does this by looping through cells.
However, when it reaches the bottom of the first sheet (row 65536) I
need it to start on the next sheet but I keep getting a Run time error.
Here is the bit of code....

If ActiveCell.Row = 65536 And ActiveSheet.Index < 9 Then
g3000SheetNumber = ActiveSheet.Index + 1
Sheets(g3000SheetNumber ).Activate
Cells(1, 1).Select

It manages to select the new sheet but when I try to select the first
cell of the sheet it throws the error. Can anyone help please??


--
smit127
------------------------------------------------------------------------
smit127's Profile: http://www.excelforum.com/member.php...o&userid=26870
View this thread: http://www.excelforum.com/showthread...hreadid=401083


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
Run-Time error '1004' : Select method of Range class failed [email protected] Excel Discussion (Misc queries) 3 March 9th 07 01:36 PM
Run-time error "1004" Select method of range class failed Tallan Excel Discussion (Misc queries) 3 March 7th 07 05:22 PM
Runtime Error 1004 Select method of Range class Failed IanO Excel Programming 2 June 16th 05 07:40 PM
error 1004 Select method of Range class failed J.E. McGimpsey Excel Programming 1 September 12th 03 07:42 PM


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

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

About Us

"It's about Microsoft Excel"