Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error

I have a workbook that has a worksheet in it that has transportation
carriers' rates. The rates are unique by carrier abbreviation,
equipment type, and destination zip zone. I have combined these
combining these three variables into a single field in each record
called Match_Code.

What I have is a error when I attempt to match these values against
the cell in the rows of the spreadsheet.

Match_Code = Carrier_Abbreviation & Equipment_Type & Zone

For c = 2 to 5961

If Match_Code = worksheets("Rates").cells(c, 13) Then
Worksheets("Entry").Range("F8") =
Worksheets("Rates").cells(c, 15)
End If

Next c

Everytime I run the above I get a Run-Time Error '13' Type Mismatch.

I can match Carrier_Abbreviation by itself in the loop and
Equipment_Type by itself in the loop. I am unable to match with the
Zone variable which is a alpha numeric code like 744PA.

Does anyone know why this is occurring? Any help is appreciated.

Thanks in advance.

Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error

Try

For c = 2 to 5961

If Match_Code = Trim(worksheets("Rates").cells(c, 13).Text) Then
Worksheets("Entry").Range("F8") = _
Worksheets("Rates").cells(c, 15)
End If

Next c


Is the data downloaded or pasted from the internet. It may contain hidden
characters that cause the problem.

For c = 2 to 5961
sStr = Trim(worksheets("Rates").cells(c, 13).Text)
sStr = Application.Substitute(sStr,chr(160)," ")
sStr = Application.Clean(sStr)

If lcase(trim(Match_Code)) = sStr Then
Worksheets("Entry").Range("F8") = _
Worksheets("Rates").cells(c, 15)
exit for ' match has been made, so quit
End If

Next c


--
Regards,
Tom Ogilvy



"rdavis7408" wrote in message
om...
I have a workbook that has a worksheet in it that has transportation
carriers' rates. The rates are unique by carrier abbreviation,
equipment type, and destination zip zone. I have combined these
combining these three variables into a single field in each record
called Match_Code.

What I have is a error when I attempt to match these values against
the cell in the rows of the spreadsheet.

Match_Code = Carrier_Abbreviation & Equipment_Type & Zone

For c = 2 to 5961

If Match_Code = worksheets("Rates").cells(c, 13) Then
Worksheets("Entry").Range("F8") =
Worksheets("Rates").cells(c, 15)
End If

Next c

Everytime I run the above I get a Run-Time Error '13' Type Mismatch.

I can match Carrier_Abbreviation by itself in the loop and
Equipment_Type by itself in the loop. I am unable to match with the
Zone variable which is a alpha numeric code like 744PA.

Does anyone know why this is occurring? Any help is appreciated.

Thanks 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
run time error 13 type mismatch Rob Bovey Excel Programming 3 April 13th 10 12:09 PM
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
run-time error 13: Type mismatch? Marko Enula Excel Discussion (Misc queries) 2 February 5th 08 01:00 PM
run time error 13 type mismatch kkknie[_170_] Excel Programming 0 July 20th 04 03:28 PM
Run Time Error '13' Type mismatch David Adamson[_3_] Excel Programming 2 June 10th 04 04:00 AM


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

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"