Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell Select
Is there a way to determine if a cell is selected? I tried to use the
onchange event, but that only works when something is changed. If a certain cell is selected, I would like to test and make sure another cell has data in it. For example, the user must choose a value from a data validation drop down list in cell C7 before the cascading list in cell D8 is populated. If they try to select cell D8 first, I want to display a message and then set cell C7 as the active cell. I'm not sure if there is a way to capture a cell select versus a change??? Thanks, Tom |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell Select
Use the selectionchange event in xl97 and later
See Chip Pearson's page on events http://www.cpearson.com/excel/events.htm Also, if you change the selection within the SelectionChange event, you should disable events (reenable them at the end) within the event to prevent recursive calls. -- Regards, Tom Ogilvy "Tom Melosi" wrote in message ... Is there a way to determine if a cell is selected? I tried to use the onchange event, but that only works when something is changed. If a certain cell is selected, I would like to test and make sure another cell has data in it. For example, the user must choose a value from a data validation drop down list in cell C7 before the cascading list in cell D8 is populated. If they try to select cell D8 first, I want to display a message and then set cell C7 as the active cell. I'm not sure if there is a way to capture a cell select versus a change??? Thanks, Tom |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell Select
Try the worksheet select event
'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$D$8" Then With Target 'do your stuff End With End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Tom Melosi" wrote in message ... Is there a way to determine if a cell is selected? I tried to use the onchange event, but that only works when something is changed. If a certain cell is selected, I would like to test and make sure another cell has data in it. For example, the user must choose a value from a data validation drop down list in cell C7 before the cascading list in cell D8 is populated. If they try to select cell D8 first, I want to display a message and then set cell C7 as the active cell. I'm not sure if there is a way to capture a cell select versus a change??? Thanks, Tom |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell Select
Thanks, worked great!
"Bob Phillips" wrote in message ... Try the worksheet select event 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$D$8" Then With Target 'do your stuff End With End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell Select
The selectionchange event is what I was looking for - Thanks!
"Tom Ogilvy" wrote in message ... Use the selectionchange event in xl97 and later See Chip Pearson's page on events http://www.cpearson.com/excel/events.htm Also, if you change the selection within the SelectionChange event, you should disable events (reenable them at the end) within the event to prevent recursive calls. -- Regards, Tom Ogilvy |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell Select
Use Private Sub Worksheet_SelectionChange(ByVal Target As Range) 'Target will be the range of the selected cell If target.row = [row number] and target.column = [column number then [your code] End If End Sub or something like tha -- TommySzalapsk ----------------------------------------------------------------------- TommySzalapski's Profile: http://www.excelforum.com/member.php...fo&userid=2556 View this thread: http://www.excelforum.com/showthread.php?threadid=38994 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA: Column Select then Data Select then return to cell A1 | Excel Discussion (Misc queries) | |||
Using formulas to select cells (Ex: Select every nth cell in a col | Excel Discussion (Misc queries) | |||
How to point to (select) a cell to the left from a cell where I enter the = equal sign? | Excel Discussion (Misc queries) | |||
I cannot select a single cell or pull down cell contents | Excel Worksheet Functions | |||
Select cell, Copy it, Paste it, Return to Previous cell | Excel Discussion (Misc queries) |