Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macor Button Dissapears Gaffnr Excel Worksheet Functions 1 May 20th 09 02:41 PM
Help with Macor gsxith3 New Users to Excel 1 August 2nd 08 01:31 PM
Macor JakeShipley2008 Excel Discussion (Misc queries) 3 June 21st 07 04:40 PM
master macor Neil Excel Discussion (Misc queries) 1 March 2nd 07 04:39 PM
How to create a macor to count the usage of another macor Jigu Excel Discussion (Misc queries) 0 March 11th 06 03:28 AM


All times are GMT +1. The time now is 01:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"