Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default onClick action from cell selection

Hi All,
In a worksheet I am creating I have a cell which, using a list
contains the options <please select, Yes and No. I would like it tha
if a user selects YES, they are automatically taken to worksheet 3 bu
is they select No, they are taken to worksheet 4. Is that possible?
If it makes any difference, I also have conditional formatting on th
cell selection.

Many thanks in advanc

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default onClick action from cell selection

Assume you are talking about Data=Validation using the List option and this
is Excel 2000 or later. Further assume that the cell in question is B9

right click on the sheet tab of the sheet with this cell and select view
code. Paste in code like this:

Private Sub Worksheet_Change(ByVal Target As Range)
If target.count 1 then exit sub
if target.address = "$B$9" then
if target.Value = "Yes" then
Worksheets(3).Activate
elseif Target.Value = "No" then
Worksheets(4).Activate
end if
End if
End Sub

--
Regards,
Tom Ogilvy


"Beanymonster " wrote in
message ...
Hi All,
In a worksheet I am creating I have a cell which, using a list,
contains the options <please select, Yes and No. I would like it that
if a user selects YES, they are automatically taken to worksheet 3 but
is they select No, they are taken to worksheet 4. Is that possible?
If it makes any difference, I also have conditional formatting on the
cell selection.

Many thanks in advance


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default onClick action from cell selection

Hi Tom - excellent - thank you very much. Works great, however....
using your example, is it possible to extend this to work on cells B10
B11, B12 etc (ie any cell with the DataValidation list option i
column B).

Also, is it possible to change the sheet tab name or does it have t
remain as default name (Sheet3, Sheet4 etc).

Sorry for all the questions, I am a severe newbie at VB stuff

thanks again

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default onClick action from cell selection

Private Sub Worksheet_Change(ByVal Target As Range)
If target.count 1 then exit sub
On error resume Next
set rng = Columns(2).SpecialCells(xlCellTypeAllValidation)
ON error goto 0
if rng is nothing then exit sub
if not Intersect(Target, rng) is Nothing then

if target.Validation.Type = xlValidateList then
if target.Value = "Yes" then
Worksheets(3).Activate
elseif Target.Value = "No" then
Worksheets(4).Activate
end if
End if
End if
End Sub

I didn't use sheet tab names. You can use sheet tab names in lieu of the
index numbers I used.

--
Regards,
Tom Ogilvy


"Beanymonster " wrote in
message ...
Hi Tom - excellent - thank you very much. Works great, however....
using your example, is it possible to extend this to work on cells B10,
B11, B12 etc (ie any cell with the DataValidation list option in
column B).

Also, is it possible to change the sheet tab name or does it have to
remain as default name (Sheet3, Sheet4 etc).

Sorry for all the questions, I am a severe newbie at VB stuff

thanks again.


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default onClick action from cell selection

thank you - very much appreciated.


:

--
Message posted from http://www.ExcelForum.com

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
Excell copy action pauses for 15 second for the smallest action Meekal Excel Discussion (Misc queries) 1 January 28th 10 04:30 PM
OnClick [email protected] Excel Discussion (Misc queries) 1 August 31st 06 06:08 PM
range onclick? Dennis Excel Programming 2 November 23rd 03 07:34 PM
Cell onclick make cell value increase. Cali92 Excel Programming 6 September 28th 03 02:27 AM


All times are GMT +1. The time now is 06: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"