Need help writing a macro


Posted by Tyler Hart on June 21, 2001 1:35 PM

I have the following:

Sheet x
Sheet y
Sheet z
One cell on sheet x contains a number.

What I want is for the macro to say "if this cell = 1 then goto sheet y else go to sheet z"

Sounds simple but I can not figure it out.

Thanks



Posted by Ben O. on June 21, 2001 1:40 PM

Try this:

Sub Macro1()
If Sheets("Sheet x").Range("A1") = 1
Then Sheets("Sheet y").Activate
Else
Sheets(Sheet z").Activate
End If
End Sub

-Ben