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: 5
Default Type mismatch while running If statement

I've got Type Mismatch error message while I'm running the following code
(It happens half way through, so I think the code can work ok, but I don't know why it stops right in the middle!!!!
How can I improve the code and solve the problem? Pls Help!!! Thanks!!!

Function Copy(ByVal RowNum As String
Sheets("Region").Selec
C1 =
For S2 = 2 To 5000
If Workbooks("Test.xls").Worksheets("Region").Cells(S 2, 1) = "" Then Exit For
If Right(Workbooks("Test.xls").Worksheets("Region").C ells(S2, 3), 3) _ <----- It stop right here
= Workbooks("Test.xls").Worksheets("Macro").Cells(Ro wNum, 4)
And Right(Workbooks("Test.xls").Worksheets("Region").C ells(S2, 3), 3)
< "South" The

For S3 = 1 To 3
Worksheets("Region").Cells(C1, S3)
= Workbooks("Test.xls").Worksheets("Region").Cells(S 2, S3
Next S
C1 = C1 +
ElseIf Left(Workbooks("Test.xls").Worksheets("Region").Ce lls(S2, 3), 4)
= Workbooks("Test.xls").Worksheets("Macro").Cells(Ro wNum, 5) The

For S3 = 1 To 3
Worksheets("Region").Cells(C1, S3)
= Workbooks("Test.xls").Worksheets("Region").Cells(S 2, S3
Next S
C1 = C1 +
End I
Next S
End Functio

 
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
Type Mismatch Error Minitman Excel Discussion (Misc queries) 7 June 21st 08 02:15 AM
Type mismatch... George[_4_] Excel Discussion (Misc queries) 7 December 19th 07 12:20 PM
Type Mismatch [email protected] Excel Worksheet Functions 1 May 16th 07 03:29 PM
type mismatch--how to fix rroach Excel Discussion (Misc queries) 2 July 14th 05 06:23 PM


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