View Single Post
  #3   Report Post  
JE McGimpsey
 
Posts: n/a
Default

How will you determine which cells?

If in advance, here's one way:

Public Sub test1()
Dim rCell As Range
For Each rCell In Range("C8,D20,C21")
If IsEmpty(rCell.Value) Then
'?..
Else
'??
End If
Next rCell
End Sub

If you want it to run on all selected cells:

Public Sub test2()
Dim rCell As Range
If TypeName(Selection) = "Range" Then
For Each rCell In Selection
If IsEmpty(rCell.Value) Then
'?..
Else
'??
End If
Next rCell
End If
End Sub


Note that selection/activation is not necessary. Using the range objects
directly makes your code smaller, faster, and IMO, easier to maintain.



In article ,
"Tan Arthur via OfficeKB.com" wrote:

I need to repeat the below task at different cell . E.g C8 ,D20 , C21 ...

Dim sRange As String
sRange = "C8"
Range(sRange).Select
If IsEmpty(ActiveCell) = True Then ?..
Else ??
End If