Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range as array
Not sure why you need an array:
If Application.CountIf(Range("G2:G1000"), Range("H1")) Then MsgBox "In the range" Else MsgBox "Not found" End If But if you really want the range values in an array, assign them to a variant variable: Dim myArr As Variant Dim i As Long myArr = Range("G2:G100").Value For i = LBound(myArr) To UBound(myArr) 'Do something Next i In article , "Robert" wrote: I need to create a macro that will use a range G2:G1000 as an array then check a cell value to find out if it is in that array. Any help is appreciated Thank you in advance Robert |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range as array
Well, what I need to do is compare the value of a cell in
B2 with the value of the Cell Range G2:G1000 and if the value in the B2 Cell is within the array I want to delete the entire row then move to the next cell(B3). I am still coming up a little short on it though...... -----Original Message----- Not sure why you need an array: If Application.CountIf(Range("G2:G1000"), Range ("H1")) Then MsgBox "In the range" Else MsgBox "Not found" End If But if you really want the range values in an array, assign them to a variant variable: Dim myArr As Variant Dim i As Long myArr = Range("G2:G100").Value For i = LBound(myArr) To UBound(myArr) 'Do something Next i In article , "Robert" wrote: I need to create a macro that will use a range G2:G1000 as an array then check a cell value to find out if it is in that array. Any help is appreciated Thank you in advance Robert . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Finding a value or the one next to it in a range NOT array | Excel Worksheet Functions | |||
How to fix an array or range | Excel Discussion (Misc queries) | |||
Using an array range in GETPIVOTDATA | Excel Worksheet Functions | |||
Dragging range (array) | Excel Discussion (Misc queries) | |||
Range as array | Excel Programming |