View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan Drummond[_3_] Rowan Drummond[_3_] is offline
external usenet poster
 
Posts: 414
Default Macro If statement to go to a specific cell in another worksheet

You could use a worksheet change event to do this. As an example:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count = 1 And Target.Value = "Y" _
And Target.Column = 1 Then 'change column as required
Sheets(2).Select
End If
End Sub

would select the second sheet every time Y is entered into a cell in
column A.
This is worksheet event code. Right click the sheet tab, select view
code and paste the event in there.

For more on events see:

http://www.cpearson.com/excel/events.htm

Hope this helps
Rowan

wrote:
I have a worksheet that has a column for a Y or N answer. If the user
answers Y, I want a macro to run to jump to the other worksheet. I
need the macro to run for each input of Y going down the worksheet.

So, how do I link a macro to a Y or N answer in a cell, and how do I
make the macro run relative to the cell with the Y answer?

Any help on this is greatly appreciated.