Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Still Having Application.Match trouble

It turns out that the problem wasn't the routine at all, rather it was
the fact that my array was more than 5461 elements long (a max in
xl2000 I guess). I've tried to set up an alternatate approach - I'll
post that separately in hopes that someone can help me review - because
its still taking more than 8 hrs to run....

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Still Having Application.Match trouble

wrote:

It turns out that the problem wasn't the routine at all, rather it was
the fact that my array was more than 5461 elements long (a max in
xl2000 I guess). I've tried to set up an alternatate approach - I'll
post that separately in hopes that someone can help me review - because
its still taking more than 8 hrs to run....

The following works; perhaps it can be utilized in your program. It
should work so long as the arrays do not have more rows than Excel
worksheets have. Watch for word wrap in your newsreader, though I tried
to allow for that.

Sub Test12345()
Dim a1, a2, a3
Dim ws8 As Worksheet, ws9 As Worksheet
Dim rng1 As Range, rng2 As Range, rng3 As Range, rng4 As Range
Dim i As Long, lb As Long, ub As Long

Set ws9 = Worksheets(9)
Set rng1 = ws9.Range("D1:D4") 'This is formatted as Text and has
'strings 10,11,12, and 13
Set rng2 = ws9.Range("A1:B20000") 'This is formatted as Text and
'has strings 10,10,10,11,11,11,
'12,12,12,12,13,13 in A1:A12
a1 = rng1
a2 = rng2
a3 = ColumnVector(a2, 1)

'Up to this point it's just a matter of loading a1 and a2
'and extracting the column vector; from here on you just
'select an available worksheet and extract the relevant
'bounds on that worksheet

Set ws8 = Worksheets(8)
Set rng3 = ws8.Range("b1:c" & UBound(a1, 1))
Set rng4 = ws8.Range("a1:a20000")
rng4.Value = a3
For i = 1 To UBound(a1, 1)
rng3(i, 1).Formula = "=MATCH(" & a1(i, 1) & "," & rng4.Address & ",0)"
rng3(i, 2).Formula = "=MATCH(" & a1(i, 1) & ", " & rng4.Address & ")"
lb = rng3(i, 1).Value
ub = rng3(i, 2).Value
Debug.Print i, lb, ub
Next
End Sub
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
Trouble with Index & Match Arturo Excel Worksheet Functions 3 June 19th 07 04:18 PM
Having trouble with vlookup and match ADiscrete1 Excel Worksheet Functions 8 November 17th 05 02:09 AM
Still Having Application.Match trouble [email protected] Excel Programming 2 September 2nd 04 09:43 AM
Application.Match [email protected] Excel Programming 0 September 2nd 04 12:07 AM
Application.Match [email protected] Excel Programming 0 September 1st 04 11:06 PM


All times are GMT +1. The time now is 07:13 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"