ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   GoTo statement question (https://www.excelbanter.com/excel-programming/433446-goto-statement-question.html)

Patrick C. Simonds

GoTo statement question
 
Is there any way to have my GoTo statement goto a label that is defined in
my UserForm1 code? UserForm1 is active when the code below is run.


Sub MissingDataTest()

With UserForm1

If .Frame1.BackColor = &H80FFFF Then
msgbox "Sorry but you must enter a Status for this no show. Ensure
that all other Yellow fields are completed."
.MultiPage1.Value = 0
.Frame1.SetFocus
GoTo MissingData
End If

End With

End Sub


Patrick Molloy[_2_]

GoTo statement question
 
GOTO are horrible IMHO, and their only use, regretfully is for the ON ERROR
statement.
So having got that off my chest ;)
Yuu could make MissingData a subroutine. There's no subsequent code, so when
it returns it wan't be an issue.



"Patrick C. Simonds" wrote:

Is there any way to have my GoTo statement goto a label that is defined in
my UserForm1 code? UserForm1 is active when the code below is run.


Sub MissingDataTest()

With UserForm1

If .Frame1.BackColor = &H80FFFF Then
msgbox "Sorry but you must enter a Status for this no show. Ensure
that all other Yellow fields are completed."
.MultiPage1.Value = 0
.Frame1.SetFocus
GoTo MissingData
End If

End With

End Sub



All times are GMT +1. The time now is 02:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com