Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determining Cell within Range
I am needing to determine if a selected cell is within a certain range. Below
is something that I have tried, but it only returns a 400 error. Sub FindRange() Dim rngMyRange As Range Set rngMyRange = Worksheets("Sheet1").Range(A1, G20) If ActiveCell.Select = rngMyRange Then MsgBox ("Good Job") Else MsgBox ("Out of Bounds") End If End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Determining Cell within Range
hi
you are trying to set the activecell to equal an entire range. try this sub FindRange() Dim rngMyRange As Range Set rngMyRange = Worksheets("Sheet1").Range("A1:G20") If Not Application.Intersect(ActiveCell, rngMyRange) Is Nothing Then MsgBox ("Good Job") Else MsgBox ("Out of Bounds") End If End Sub regards FSt1 "Pablo" wrote: I am needing to determine if a selected cell is within a certain range. Below is something that I have tried, but it only returns a 400 error. Sub FindRange() Dim rngMyRange As Range Set rngMyRange = Worksheets("Sheet1").Range(A1, G20) If ActiveCell.Select = rngMyRange Then MsgBox ("Good Job") Else MsgBox ("Out of Bounds") End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Determining Frequency of range | Excel Worksheet Functions | |||
Determining Range of selected cell | Excel Programming | |||
Determining last copied range | Excel Programming | |||
Determining range | Excel Programming |