![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Posts: 3
|
This is a really newbie question, I know.. but how do you call a public sub from another sub?
|
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Newcastle, UK
Posts: 1,174
|
Quote:
E.g. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) If Whatever = True Then MacroNameNothingElse Else Exit Sub End If End Sub
__________________
"Have a good time......all the time" Ian Mac |
|
|
|
|
|
|
#3 |
|
New Member
Join Date: May 2002
Posts: 3
|
the name itself doesn't seem to work.. I should explain the program a bit: it runs automatically as the workbook is loaded, shows a userform and then a menu whitch is called from another module. Here's the code:
Sub auto_open() Userform1.Show End Sub Sub deleteform() Unload Userform1 End Sub the public sub is in a different module, and it should be run automatically, so I think the command to call it should be placed in the sub "deleteform". Here's the sub: Public Sub addmenustudents() '=== It displays the Students menu Dim Menu As Menustudents Set Menu = New Menustudents Call Menu.addstudents End Sub it calls a menu whitch is in a class module. |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Newcastle, UK
Posts: 1,174
|
Quote:
I'm sure what the order of events are. Can you post any other code that drives the Automatic events from the begining.
__________________
"Have a good time......all the time" Ian Mac |
|
|
|
|
|
|
#5 |
|
New Member
Join Date: May 2002
Posts: 3
|
Sorry, I just noticed that it works after all.. I thought it was supposed to open the menu in the screen but instead it places it in the menu bar. So, it works with the sub name as you told me in the first place..
Anyway, thank you for the help! |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|