View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
BSc Chem Eng Rick BSc Chem Eng Rick is offline
external usenet poster
 
Posts: 118
Default Running macro based on cell value

Monomeeth,

Use the "Worksheet_Change" Event to run the specified macro as follows:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$3" Then
MyModule1
End If
End Sub

Note that "$B$3" above must be replaced by the cell in which your dropdown
list is located. Also this procedure must be located in the Code of the Sheet
which contains your list, NOT in a separate module.

If this helps please click "Yes"
<<<<<<<<<<


"Monomeeth" wrote:

Hello

I have a workbook which acts as a menu by displaying multiple macro buttons
for selection by users. Basically, the user clicks on the button with their
name on it and then a macro runs asking the user to enter a password and, if
the password is correct, proceeds to open up a unique workbook for use only
by that user. The same macro also closes down the "menu" workbook so that it
is available to other users.

The problem I have is that we now have to set this up for about a hundred
people, so it will no longer be practical to keep adding macro buttons for
each user. So what I want to do is present the user with a drop-down menu
from which they can select their name to open up that user's workbook.
Currently I have one macro per user behind the scenes, so this means I need a
way for the selection (cell value?) to activate that user's macro.

So, how do I do this? I'm a bit lost as to how to proceed, although I'm
guessing some sort of "If Then" statement is what I need.

Any suggestions? Your help would be most appreciated!

Thanks,

Joe.

--
If you can measure it, you can improve it!