ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range as array (https://www.excelbanter.com/excel-programming/276683-re-range-array.html)

Chip Pearson

Range as array
 
Robert,

You can use the Match function to look directly in the cells. E.g.,

Dim Res As Variant
Res = Application.Match(123, Range("G1:G1000"), 0)
If IsError(Res) Then
MsgBox "not found"
Else
MsgBox "found"
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com



"Robert" wrote in message
...
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





All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com