Cell Select

  • Thread starter Thread starter Tom Melosi
  • Start date Start date
T

Tom Melosi

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
 
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.
 
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)
 
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
 
Back
Top