Macro If statement to go to a specific cell in another worksheet
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. |
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. |
All times are GMT +1. The time now is 10:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com