Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have been trying to write a procedure that checks if a selected cell is in
a range of cells. I wrote the following code: Sub intersct() Dim xcell As Range Dim a As String Dim rng1 As Range Dim rng2 As Range Dim rng3 As Range Set xcell = ActiveCell.EntireRow.Cells(1) a = xcell.Text Do While a = "" Set xcell = xcell.Offset(-1, 0) a = xcell.Text Loop costid = a MsgBox (costid) Set rng1 = Range(costid & "estsubvenrng") Set rng2 = Range(costid & "estdescriptrng") Set rng3 = Range(costid & "estamountrng") Set isect = Application.Intersect(rng1, rng2, rng3) If isect Is Nothing Then MsgBox "nothing" Else MsgBox "Intersect" End If End Sub When I run it I always get msgbox "Nothing" even when the selected cell is within the range of cells. What am I doing wrong? Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Intersect | Excel Programming | |||
Intersect | Excel Programming | |||
Intersect Formula??? | Excel Programming | |||
Intersect Formula VBA Help | Excel Programming | |||
Help with If Not Intersect | Excel Programming |