View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default creating a range by searching another worksheet

Hi
some questions
- is your data sorted
- does it start in a fixed row

--
Regards
Frank Kabel
Frankfurt, Germany

"Rich Cooper" schrieb im Newsbeitrag
...
Frank
Thats helping alot but i am running into some problems. Hopefully

you can
help. I want the row it starts at to be M1P1 and in the array i want

it tp
only count M1 once. SO the final array should look like this if i

only have
a list that goes up to M4P4. ar_values("m1","m2","m3"m4") Hope that

makes
it a little clear what i am trying to do.

"Frank Kabel" wrote in message
...
Hi
try the following (not fully tested)
sub test_rng
dim ar_values as variant
Dim RowNdx As Long
Dim LastRow As Long
dim i

LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
redim ar_values(1 to lastrow)
i=0

For RowNdx = 1 To lastrow
with Cells(RowNdx, "A")
if left(.value,1)="M" then
i=i+1
ar_values(i)=left(.value,2)
end if
end with
Next RowNdx
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany

"Rich Cooper" schrieb im Newsbeitrag
...
I am trying to build a range by having a procedure go through a

range. I
have a range of markets. The range is column A. In column A at

the
very
top you have some summary information then you have M1P1,
M1p2...M2p2...M3p5... I am trying to create an array that will

be
("m1",
"m2", "m3"...) but i am having trouble doing this. I can't get

the
procedure to go throught the range. Any help on how to do this

is
greatly
appreciated.