![]() |
Is Active Cell in a Range?
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? |
Is Active Cell in a Range?
If intersect(activecell, range("a1:b99")) is nothing then
msgbox "not in a1:b99 else msbox "yes, I am!" end if 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? -- Dave Peterson |
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? |
Is Active Cell in a Range?
cool. mine works, but dave's is better.
:) susan On Jan 17, 4:11*pm, Dave Peterson wrote: If intersect(activecell, range("a1:b99")) is nothing then * msgbox "not in a1:b99 else * msbox "yes, I am!" end if 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? -- Dave Peterson |
All times are GMT +1. The time now is 05:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com