Testing a cell
Well done Dave,
Something new to learn.
I am using Select Case because my application could have 12 different
values and types of values.
Thanks,
Michael
Dave Peterson wrote:
How about:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Target(1), Range("B1:B20")) Is Nothing Then
Select Case True
Case IsEmpty(Target(1).Value): Range("D1").Value = "Empty"
Case Len(Target(1).Value) 0: Range("d2").Value = "Full"
End Select
End If
End Sub
Watch your double quotes (mentioned before). But is there a reason you used
"select case" instead of a simple if/then?
And I used just the first cell in the Target.
Michael Singmin wrote:
Hello group,
I am trying to detect if a cell is blank.
The Empty case always triggers correctly
but never the Full case when a cell has something in it.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Target, Range("B1:B20")) Is Nothing Then
Select Case Target
Case IsEmpty("Target"): [D1] = "Empty"
Case Len("Target") 0: [D2] = "Full"
End Select
End If
End Sub
Any insight ?
Thanks,
Michael Singmin
|