Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Alec H
 
Posts: n/a
Default If.....Then GoTo.......


Hi,

Stuck again..

I have a line of code that reads

If (P20) < 1 Then GoTo ????

I want the ???? to refer to the last line of the Sub which is..

Sheets("Customer List").Select

In other words to miss out all other lines of the code and go directly
to the last line. I keep getting told to either refer to a line label
or a line number, currently the code does not have line numbers (I
think) and I dont know how to create a "label" that refers to a line
within the code.....


Help.


--
Alec H
------------------------------------------------------------------------
Alec H's Profile: http://www.excelforum.com/member.php...o&userid=31042
View this thread: http://www.excelforum.com/showthread...hreadid=512643

  #2   Report Post  
Posted to microsoft.public.excel.misc
tdols
 
Posts: n/a
Default If.....Then GoTo.......


replace the ??? with anyname followed by ":" so for example Exitthis:

code
-
-
Exitthis:
sheet1. do something
End Sub


--
tdols
------------------------------------------------------------------------
tdols's Profile: http://www.excelforum.com/member.php...o&userid=31565
View this thread: http://www.excelforum.com/showthread...hreadid=512643

  #3   Report Post  
Posted to microsoft.public.excel.misc
Ken Johnson
 
Posts: n/a
Default If.....Then GoTo.......

Hi Alec,
Write a label after the GoTo and then before Sheets("Customer
List").Select
For example:

If (P20) < 1 Then GoTo SKIP

rest of code...

SKIP:Sheets("Customer List").Select
End Sub

Note the : after the label SKIP
The SKIP label does not affect the normal execution of the last line
when (P20)=1
Ken Johnson

  #4   Report Post  
Posted to microsoft.public.excel.misc
R..VENKATARAMAN
 
Posts: n/a
Default If.....Then GoTo.......

just before the line
Sheets("Customer List").Select
type
line1:
(i.e line1 and colon)
the original line should be
if range("P20")<1 goto line1



"Alec H" wrote in
message ...

Hi,

Stuck again..

I have a line of code that reads

If (P20) < 1 Then GoTo ????

I want the ???? to refer to the last line of the Sub which is..

Sheets("Customer List").Select

In other words to miss out all other lines of the code and go directly
to the last line. I keep getting told to either refer to a line label
or a line number, currently the code does not have line numbers (I
think) and I dont know how to create a "label" that refers to a line
within the code.....


Help.


--
Alec H
------------------------------------------------------------------------
Alec H's Profile:
http://www.excelforum.com/member.php...o&userid=31042
View this thread: http://www.excelforum.com/showthread...hreadid=512643



  #5   Report Post  
Posted to microsoft.public.excel.misc
Alec H
 
Posts: n/a
Default If.....Then GoTo.......


Thanks all :)


--
Alec H
------------------------------------------------------------------------
Alec H's Profile: http://www.excelforum.com/member.php...o&userid=31042
View this thread: http://www.excelforum.com/showthread...hreadid=512643

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
create a goto button in excel billy boy Excel Worksheet Functions 1 November 25th 05 04:30 PM
Goto in IF statment =\ Excel Discussion (Misc queries) 3 August 14th 05 04:11 PM
Using 'GoTo' in a Macro adam777 Excel Discussion (Misc queries) 0 June 29th 05 09:16 PM
Goto a dynamic cell address within a macro blkane Excel Discussion (Misc queries) 3 June 8th 05 07:08 PM
Validation Data & Goto question ma Excel Discussion (Misc queries) 2 March 1st 05 08:54 PM


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