Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding a value or the one next to it in a range NOT array advanced novice Excel Worksheet Functions 3 August 6th 08 02:54 PM
How to fix an array or range delboy Excel Discussion (Misc queries) 1 February 12th 08 08:14 PM
Using an array range in GETPIVOTDATA Steve Excel Worksheet Functions 0 August 10th 06 07:45 PM
Dragging range (array) Rita Palazzi Excel Discussion (Misc queries) 1 June 29th 06 06:19 PM
Range as array Chip Pearson Excel Programming 0 September 10th 03 10:40 PM


All times are GMT +1. The time now is 04:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"