I hope someone can help with this.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
>
I have a macro which performs various validation tests on data entered into a worksheet. Each test is identified by a line label and either displays a message box and ends the macro if there’s an error with the data or moves on to the next test using a GoTo statement to route the macro to the appropriate line label.<o
></o
>
I’d like to be able to give each message box the title of the line label for the current test. Is there any way for the macro to pick up the line label or will I have to type it in for each test?<o
></o
>
<o
> </o
>
An example of a test is a follows and I’d like MBoxTitle to pick up the line label without me typing it in each time:- <o
></o
>
<o
> </o
>
Dim NilTestValue<o
></o
>
Dim MBoxTitle<o
></o
>
<o
> </o
>
NILCREDITTEST:<o
></o
>
MBoxTitle = "NILCREDITTEST"<o
></o
>
<o
> </o
>
NilTestValue = Application.WorksheetFunction.CountIf(Range("CREDIT_FOR_NIL_TEST"), "NIL")<o
></o
>
If NilTestValue = 8 Then<o
></o
>
MsgBox Prompt:="YOU HAVE ENTERED NIL VAULES CORRECT DATA AND RE-RUN MACRO.", Title:=MBoxTitle<o
></o
>
Exit Sub<o
></o
>
Else<o
></o
>
GoTo NEXTTEST<o
></o
>
End If<o
></o
>
Thanks in anticipation
I have a macro which performs various validation tests on data entered into a worksheet. Each test is identified by a line label and either displays a message box and ends the macro if there’s an error with the data or moves on to the next test using a GoTo statement to route the macro to the appropriate line label.<o
I’d like to be able to give each message box the title of the line label for the current test. Is there any way for the macro to pick up the line label or will I have to type it in for each test?<o
<o
An example of a test is a follows and I’d like MBoxTitle to pick up the line label without me typing it in each time:- <o
<o
Dim NilTestValue<o
Dim MBoxTitle<o
<o
NILCREDITTEST:<o
MBoxTitle = "NILCREDITTEST"<o
<o
NilTestValue = Application.WorksheetFunction.CountIf(Range("CREDIT_FOR_NIL_TEST"), "NIL")<o
If NilTestValue = 8 Then<o
MsgBox Prompt:="YOU HAVE ENTERED NIL VAULES CORRECT DATA AND RE-RUN MACRO.", Title:=MBoxTitle<o
Exit Sub<o
Else<o
GoTo NEXTTEST<o
End If<o
Thanks in anticipation