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

Can someone explain to me why the first of these two examples works,
but the second doesn't?

Example 1:

Sub Test
Dim i As Integer
Dim v, arr(999) As String
Dim u,l As Long
For i = 0 to 9
arr(i) = "00" & CStr(i)
Next i
For i = 10 to 99
arr(i) = "0" & CStr(i)
Next i
For i = 100 to 999
arr(i) = Cstr(i)
Next i
v = "600"
l = Application.Match(v,arr,0)
u = Application.Match(v,arr)
End Sub

Example 2

Assume that there are a set of numbers as strings in cells A1 - A1000

Sub Test
Dim i As Integer
Dim v, arr(999) As String
Dim u,l As Long
For i = 1 to 1000
arr(i-1) = CStr(Range("A1").Offset(i-1,0).Value)
v = CStr(Range("A1").Offset(600,0).Value)
l = Application.Match(v,arr,0)
u = Application.Match(v,arr)
End Sub

In the case of the first example, everything works, in the case of the
second (which is simplified from my real code), I'm getting a type
mismatch error.

I've done a "Watch" on both the item to be matched and the single
column array and in both cases each and every item in both is a String.

 
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
application.match Chip Smith Excel Discussion (Misc queries) 3 March 30th 06 08:56 PM
Having trouble with vlookup and match ADiscrete1 Excel Worksheet Functions 8 November 17th 05 02:09 AM
Application.Match [email protected] Excel Programming 5 September 2nd 04 04:22 PM
Application.Match [email protected] Excel Programming 1 September 2nd 04 08:20 AM


All times are GMT +1. The time now is 03:29 PM.

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

About Us

"It's about Microsoft Excel"