close

Hi,

Stuck again..

I have a line of code that reads

If (P20) lt; 1 Then GoTo ????

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

Sheets(quot;Customer Listquot;).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 quot;labelquot; that refers to a line
within the code.....Help.--
Alec H
------------------------------------------------------------------------
Alec H's Profile: www.excelforum.com/member.php...oamp;userid=31042
View this thread: www.excelforum.com/showthread...hreadid=512643
replace the ??? with anyname followed by quot;:quot; so for example Exitthis:

code
-
-
Exitthis:
sheet1. do something
End Sub--
tdols
------------------------------------------------------------------------
tdols's Profile: www.excelforum.com/member.php...oamp;userid=31565
View this thread: www.excelforum.com/showthread...hreadid=512643Hi Alec,
Write a label after the GoTo and then before Sheets(quot;Customer
Listquot;).Select
For example:

If (P20) lt; 1 Then GoTo SKIP

rest of code...

SKIP:Sheets(quot;Customer Listquot;).Select
End Sub

Note the : after the label SKIP
The SKIP label does not affect the normal execution of the last line
when (P20)gt;=1
Ken Johnsonjust before the line
Sheets(quot;Customer Listquot;).Select
type
line1:
(i.e line1 and colon)
the original line should be
if range(quot;P20quot;)lt;1 goto line1
quot;Alec Hquot; gt; wrote in
message ...
gt;
gt; Hi,
gt;
gt; Stuck again..
gt;
gt; I have a line of code that reads
gt;
gt; If (P20) lt; 1 Then GoTo ????
gt;
gt; I want the ???? to refer to the last line of the Sub which is..
gt;
gt; Sheets(quot;Customer Listquot;).Select
gt;
gt; In other words to miss out all other lines of the code and go directly
gt; to the last line. I keep getting told to either refer to a line label
gt; or a line number, currently the code does not have line numbers (I
gt; think) and I dont know how to create a quot;labelquot; that refers to a line
gt; within the code.....
gt;
gt;
gt; Help.
gt;
gt;
gt; --
gt; Alec H
gt; ------------------------------------------------------------------------
gt; Alec H's Profile:
gt; www.excelforum.com/member.php...oamp;userid=31042
gt; View this thread: www.excelforum.com/showthread...hreadid=512643
gt;

Thanks all --
Alec H
------------------------------------------------------------------------
Alec H's Profile: www.excelforum.com/member.php...oamp;userid=31042
View this thread: www.excelforum.com/showthread...hreadid=512643

全站熱搜
創作者介紹
創作者 software 的頭像
software

software

software 發表在 痞客邦 留言(0) 人氣()