View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default On Got Focus, Clear Cells

This works in the selection event, not quite as you ask but see if it meets
your needs.

It goes in the Worksheet module, right-click tab, view code

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Dim col As Long

col = Target(1).Column
If col = 1 Or col = 5 Then
On Error Resume Next
nt = ActiveCell.Validation.Type
On Error GoTo 0
If nt = 3 Then
If col = 1 Then
Set rng = Range("B1,D1:E1")
Else
Set rng = Range("A1:B1,D1")
End If
rng.Offset(Target.Row - 1).ClearContents
End If
End If

End Sub

Regards,
Peter T

"Suzanne" wrote in message
...
I can't quite figure out the right code for this:

On selection (GotFocus) of a validation drop-down in Column A, clear cells
in Columns B, D, & E; OR on selection (GotFocus) of the validation

drop-down
in Column E, clear cells in Columns A, B, & D

Only the cells on the row with focus should be cleared

Thanks -- Suzanne