• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Ignore Codes Using GoTo NextArea and Updating Numbers in cells

VB_Noob

Member
Hi All,

I got an error message stating "Next Area" is not defined when I used the following codes.

If statement
code line 1
code line 2
GoTo Next Area 'so I want to ignore code line 3 and 4, go straight to Else then.
code line 3
code line 4
Next Area
Else Then
execute codes here

What is wrong with the codes above?

Also I have create a long table and there is mixed numbers and text in each cell. The numbers are associated to the cells numbers at the top of the sheet.

I need to update the numbers in the table. Is there a way to ask Excel to auto update the numbering in each cell instead of having me manually updating them?

Thanks
 
Hi !

No need Goto statement from the VBA beginning, so more than 20 years !
Just apply easy logic as you can see in VBA inner help of
IfThenElseEnd If block statements for example …
 
I need to temporarily ignore those codes and will need them later.

I know I can put ' at the beginning of each code line manually. But it would be a pain to do that for hundred lines of code.
 
Yep, other than some error handling, there really is no need of GoTo statement.

If you need the code temporarily... just split it out in another sub routine and call it in your main code (using some condition or another).

But then, without knowing your full code, hard for us to give you suggestion on better approach.
 
Back
Top