View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default Is Active Cell in a Range?

how 'bout.........

Sub wheres_cell()

Dim myRange As Range
Dim c As Range

Set myRange = Range("c2:c7")

For Each c In myRange
If ActiveCell.Address = c.Address Then
MsgBox "I'm in the range :) " & c.Address
Exit Sub
Else
'do nothing
End If
Next c

MsgBox "I'm not in the range :("

End Sub


works for me. change to fit your ranges.
susan


On Jan 17, 3:55*pm, Aaron wrote:
I want to write some code like,

If Activecell is part of range whatever then
if true....
else
If fales....
End if

How do I say that?