Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I create an if statement that looks for a specific cell color? waladd Excel Worksheet Functions 2 February 17th 07 06:39 PM
an if( statement looking for a specific phrase anywhere in a cell Bob Phillips Excel Worksheet Functions 3 September 26th 06 12:13 AM
Macro/Loop If Statement Help -delete the row with the specific te Bricktop Excel Programming 5 October 28th 05 09:50 PM
Macro to cut rows into another worksheet if a cell contains a specific word Jason via OfficeKB.com Excel Programming 4 May 7th 05 11:33 AM
Search for a specific character in a cell in an if statement mcl Excel Worksheet Functions 2 January 4th 05 09:14 PM


All times are GMT +1. The time now is 04:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"