LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Error 1004 help

Carl,

My understanding of your problem was that the inner loop
did not terminate when it was rerun by the outer loop the
second time. This is what should happen if you don't
rezero the Y variable after completion of each inner loop.

Note that your code increments the Y variable (column
offset) by 1 until it equals 119. Then the inner loop
terminates ("Loop Until Y = 119"). The outer loop then
causes a row offset downward and then reruns the inner
loop. However, Y equals 119 at the start of the second
run of the inner loop and is immediately incremented by 1
and therefore equals 120. At this point, the
statement "Loop Until Y = 119" will have no effect because
Y already exceeds 119 and continues to be incremented.
Therefore, the inner loop cannot self-terminate.
Consequentially, your code continues to reference one
column to the right until it attempts to reference beyond
the last column in the worksheet. This will cause Error
1004. If you run the code with the line that rezeros the
Y variable then this won't happen.

I assumed that the named ranges "ONHAND" and "Received"
were single cell ranges on the active sheet. I ran your
code after creating these named ranges and received the
Error 1004 message. I then ran it with the line that
rezeros the Y variable and it worked according to my
understanding of your intention.

Please advise if you have run the code with the line that
rezeros the Y variable and if the named ranges "ONHAND"
and "Received" refer to single cell ranges on the active
sheet. Also, since there are more than one version of
Error 1004 message, please advise of what else it says.

Regards,
Greg


 
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
error 1004 (VBA) Harlan Grove Setting up and Configuration of Excel 0 May 15th 06 07:33 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
Runtime error '1004' General ODBC error star_lucas New Users to Excel 0 August 29th 05 04:09 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Error no. 1004 Cyrus[_2_] Excel Programming 1 October 22nd 03 01:06 PM


All times are GMT +1. The time now is 05:51 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"