Run conditional macros

A

Ander

Hi,

I wonder if there is a way to run macros conditionally (using the I
function).

For example, if the value of cell A1 is "up" run the macro "go up" an
if the value is any other thing, run the macro "stay there".

I appreciate in advance any help that you can provide me in thi
matter.

Ande
 
M

mudraker

Ander


You will need to install a Worksheet_Change macro in the workshee
module sheet




Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then
Select Case Target.Value
Case "up"
Call goup
Case Else
Call staythere
End Select
End If
End Su
 
A

Ander

Thanks for your response Mudraker!!!

However, I'm kind of a "macro beginner" and I don't really know ho
to:

"install a Worksheet_Change macro in the worksheet module sheet"


I tried creating a blank macro and pasting your code in the midle o
the "Sub" and "End Sub" sentences, but it didn't work...

Thanks again,

Ande
 
M

Max

"install a Worksheet_Change macro in the worksheet module sheet"

Think the above means to put into a "Sheet" module
(what you did was for the standard module):

Try:

Right-click on the sheet tab > View Code

Copy > Paste the code into the whitespace on the right
(Clear the defaults appearing in the whitespace first)
 
M

mudraker

Ander


When you goto Visual Basic Explorer you should have several window
open.

One of them is the Project Explorer Window . Usually located top lef
corner. This window displays a tree of the workbook showing all th
sheets.

Double Click on Sheet1 which will open the worksheet1 module

You then need to paste my code into this sheet where the cursor i
flashing. I am assuming there is no other code on this sheet.


If the Project Explore window is not visiable you can open it b
pressing the Ctrl + R key
 
Top