Thread: Testing a cell
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Pete McCosh[_5_] Pete McCosh[_5_] is offline
external usenet poster
 
Posts: 59
Default Testing a cell

Michael,

the problem is the quotes: you are testing the length of
the string "Target", rather than the length of the value
in the cell Target. Use:

Len(Target) or Len(Target.Value)

Alternatively, why not just use:

Case Else

Cheers, Pete

-----Original Message-----
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


.