Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
end sub in If then macor
If I want to end the sub routine "Private Sub
UserForm_Initialize()" in a if then command, what will be the command for that. I tried end Sub and Exit Sub but that doesn't seem to work |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
end sub in If then macor
If a = 1 GoTo Macro_End
Macro_End: End Sub "P. Blaauw" wrote in message ... If I want to end the sub routine "Private Sub UserForm_Initialize()" in a if then command, what will be the command for that. I tried end Sub and Exit Sub but that doesn't seem to work |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
end sub in If then macor
Try this example that don't run the code if cell A1 have a value of 1
Private Sub UserForm_Initialize() If Sheets("sheet1").Range("a1").Value = 1 Then Exit Sub MsgBox "hi" End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "P. Blaauw" wrote in message ... If I want to end the sub routine "Private Sub UserForm_Initialize()" in a if then command, what will be the command for that. I tried end Sub and Exit Sub but that doesn't seem to work |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
end sub in If then macor
Hi,
It seems that you don't wand the form to show. If it's the case, exit sub will jus get you out of the initialize procedure and keep display the form. As the name said, it is use to give initial values to something. To remove the form, use a code like that: If MsgBox("ok", vbYesNo) = vbYes Then Unload Me And in the procedure that display the form, trap the error because it will try to display some thing that is not in memory. On Error Resume Next UserForm1.Show -- JP http://www.solutionsvba.com "P. Blaauw" wrote in message ... If I want to end the sub routine "Private Sub UserForm_Initialize()" in a if then command, what will be the command for that. I tried end Sub and Exit Sub but that doesn't seem to work |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macor Button Dissapears | Excel Worksheet Functions | |||
Help with Macor | New Users to Excel | |||
Macor | Excel Discussion (Misc queries) | |||
master macor | Excel Discussion (Misc queries) | |||
How to create a macor to count the usage of another macor | Excel Discussion (Misc queries) |