Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Gail Knight   on Dec 19 In MS Office Category.

  
Question Answered By: Kristin Johnston   on Dec 19

Normally, I would say that it would help  if we knew
what the error  was and where it occurs, but in this case,
I can see right off that you've got several problems!
You say:
for row  = 1 to 30000
then you immediately say:
row = 1
that means that in each loop (of 30000)
"row" will ALWAYS be 1 !!! because you TOLD it TO!
also, I would suggest NOT using variables that are the
same as reserved words (or methods, or procedures)
because it can cause problems.
like if you're trying to determine the current row
and say: ActiveCell.row
is that Excel's ROW, or YOUR ROW (which would cause an error).
There's also lots of confusing things here.
The For row = 1 to 300000 will keep incrementing "row" by 1
but then you have row = row + 1, which ALSO increments "row".
Also.. the statement: Range("E(row + 1)").Select
is NOT legal. there is no range called "E(row + 1)"
because the quotes (") indicate that you want to use this
LITERALLY, not use the values they represent.
so... I think we need a "melt and re-pour" here...
tell us what you want to do...
the looping part is much easier than you're making it.
for I = 1 to 30000
if (cells(I,5) = "") then exit for
Next I

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on VBA Coding Error Question Or get search suggestion and latest updates.


Tagged: