Using line label as message box title

KEITHH

New Member
Joined
Oct 26, 2009
Messages
10
I hope someone can help with this.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
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:p></o:p>
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:p></o:p>
<o:p> </o:p>
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:p></o:p>
<o:p> </o:p>
Dim NilTestValue<o:p></o:p>
Dim MBoxTitle<o:p></o:p>
<o:p> </o:p>
NILCREDITTEST:<o:p></o:p>
MBoxTitle = "NILCREDITTEST"<o:p></o:p>
<o:p> </o:p>
NilTestValue = Application.WorksheetFunction.CountIf(Range("CREDIT_FOR_NIL_TEST"), "NIL")<o:p></o:p>
If NilTestValue = 8 Then<o:p></o:p>
MsgBox Prompt:="YOU HAVE ENTERED NIL VAULES CORRECT DATA AND RE-RUN MACRO.", Title:=MBoxTitle<o:p></o:p>
Exit Sub<o:p></o:p>
Else<o:p></o:p>
GoTo NEXTTEST<o:p></o:p>
End If<o:p></o:p>

Thanks in anticipation
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Thanks Andrew.
I'd guessed as much but thought it was worth asking anyway given the breadth of knowledge and experience out there.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top