Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Type Mismatch Error

Check the spelling of that worksheet "Finance data report".

My bet is that the name in the code doesn't match the name of the
worksheet--maybe extra space characters???

ps.

Another way to check for that specific error:

if c.text = "#N/A" then
'skip it
else
worksheets(....

Ayo wrote:

Now I am getting a "Subscript out of range" error on the row with the arrow

Set myRange = Worksheets(2).Range("A3:A" & lastrow)
For Each c In myRange
If Not IsError(c.Value) Then
-- Worksheets("Finance Data Report").Cells(rw, 2) = c.Value
Worksheets("Finance Data Report").Cells(rw, 3) = c.Offset(0, 1)
Worksheets("Finance Data Report").Cells(rw, 4) = c.Offset(0, 2)
Worksheets("Finance Data Report").Cells(rw, 5) = c.Offset(0, 4)
Worksheets("Finance Data Report").Cells(rw, 6) = c.Offset(0, 5)
Worksheets("Finance Data Report").Cells(rw, 10) = c.Offset(0, 7)
Worksheets("Finance Data Report").Cells(rw, 11) = c.Offset(0, 10)
End If
rw = rw + 1
Next c

"papou" wrote:

Hello Ayo
If Not IsError(c.Value) Then

HTH
Cordially
Pascal

"Ayo" a écrit dans le message de news:
...
I need help dealing with an error message on this line of code: "If c.Value
=
"#N/A" Then". I keep getting a type mismatch error and I don't know why. I
am
try to tell the programme to ignore any cell that contains "#N/A" and go
on
to the next cell.
I need help here. I have been working on this macro now for abot 3 weeks.

Set myRange = Worksheets(2).Range("A3:A" & lastrow)
For Each c In myRange
If c.Value = "#N/A" Then
ElseIf c.Value < "#N/A" Then
Worksheets("Finance Data Report").Cells(rw, 2) = c.Value
Worksheets("Finance Data Report").Cells(rw, 3) = c.Offset(0, 1)
Worksheets("Finance Data Report").Cells(rw, 4) = c.Offset(0, 2)
Worksheets("Finance Data Report").Cells(rw, 5) = c.Offset(0, 4)
Worksheets("Finance Data Report").Cells(rw, 6) = c.Offset(0, 5)
Worksheets("Finance Data Report").Cells(rw, 10) = c.Offset(0,
7)
Worksheets("Finance Data Report").Cells(rw, 11) = c.Offset(0,
10)
End If
rw = rw + 1
Next c





--

Dave Peterson
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Type Mismatch Error

Thanks. That was it. I saw it and fixed it already.

"Dave Peterson" wrote:

Check the spelling of that worksheet "Finance data report".

My bet is that the name in the code doesn't match the name of the
worksheet--maybe extra space characters???

ps.

Another way to check for that specific error:

if c.text = "#N/A" then
'skip it
else
worksheets(....

Ayo wrote:

Now I am getting a "Subscript out of range" error on the row with the arrow

Set myRange = Worksheets(2).Range("A3:A" & lastrow)
For Each c In myRange
If Not IsError(c.Value) Then
-- Worksheets("Finance Data Report").Cells(rw, 2) = c.Value
Worksheets("Finance Data Report").Cells(rw, 3) = c.Offset(0, 1)
Worksheets("Finance Data Report").Cells(rw, 4) = c.Offset(0, 2)
Worksheets("Finance Data Report").Cells(rw, 5) = c.Offset(0, 4)
Worksheets("Finance Data Report").Cells(rw, 6) = c.Offset(0, 5)
Worksheets("Finance Data Report").Cells(rw, 10) = c.Offset(0, 7)
Worksheets("Finance Data Report").Cells(rw, 11) = c.Offset(0, 10)
End If
rw = rw + 1
Next c

"papou" wrote:

Hello Ayo
If Not IsError(c.Value) Then

HTH
Cordially
Pascal

"Ayo" a écrit dans le message de news:
...
I need help dealing with an error message on this line of code: "If c.Value
=
"#N/A" Then". I keep getting a type mismatch error and I don't know why. I
am
try to tell the programme to ignore any cell that contains "#N/A" and go
on
to the next cell.
I need help here. I have been working on this macro now for abot 3 weeks.

Set myRange = Worksheets(2).Range("A3:A" & lastrow)
For Each c In myRange
If c.Value = "#N/A" Then
ElseIf c.Value < "#N/A" Then
Worksheets("Finance Data Report").Cells(rw, 2) = c.Value
Worksheets("Finance Data Report").Cells(rw, 3) = c.Offset(0, 1)
Worksheets("Finance Data Report").Cells(rw, 4) = c.Offset(0, 2)
Worksheets("Finance Data Report").Cells(rw, 5) = c.Offset(0, 4)
Worksheets("Finance Data Report").Cells(rw, 6) = c.Offset(0, 5)
Worksheets("Finance Data Report").Cells(rw, 10) = c.Offset(0,
7)
Worksheets("Finance Data Report").Cells(rw, 11) = c.Offset(0,
10)
End If
rw = rw + 1
Next c




--

Dave Peterson

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
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
Conditional Formatting - Run Time Error '13' Type Mismatch Error ksp Excel Programming 0 July 11th 06 07:06 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
type mismatch error Monique Excel Programming 3 July 21st 05 09:19 AM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM


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