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

This gives me a type mismatch in Excel 2007 but not in 2003

If Cells(MyRow, MyCol) = 0 Or IsEmpty(Cells(MyRow, MyCol)) Then

Does anyone know why?

Thanks.

Bill

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Type Mismatch

What does Cells(MyRow,MyCol) contain when you get the type mismatch error.

If it contains an Excel Error Value, that can cause that problem (but I
would expect it in any version).

In Excel 97, comparing a string to a Number (zero in this case) would raise
a type mismatch - I don't have xl2007 to test, but maybe they when backwards
in of the fix to that problem.

You could try

If Cells(MyRow, MyCol).Text = "0" Or IsEmpty(Cells(MyRow, MyCol)) Then


--
Regards,
Tom Ogilvy






"Stout" wrote:

This gives me a type mismatch in Excel 2007 but not in 2003

If Cells(MyRow, MyCol) = 0 Or IsEmpty(Cells(MyRow, MyCol)) Then

Does anyone know why?

Thanks.

Bill


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Type Mismatch

On May 31, 1:35 pm, Tom Ogilvy
wrote:
What does Cells(MyRow,MyCol) contain when you get the type mismatch error.

If it contains an Excel Error Value, that can cause that problem (but I
would expect it in any version).

In Excel 97, comparing a string to a Number (zero in this case) would raise
a type mismatch - I don't have xl2007 to test, but maybe they when backwards
in of the fix to that problem.

You could try

If Cells(MyRow, MyCol).Text = "0" Or IsEmpty(Cells(MyRow, MyCol)) Then

--
Regards,
Tom Ogilvy

"Stout" wrote:
This gives me a type mismatch in Excel 2007 but not in 2003


If Cells(MyRow, MyCol) = 0 Or IsEmpty(Cells(MyRow, MyCol)) Then


Does anyone know why?


Thanks.


Bill


Thanks man...that was it. It had errors...macros were not enabled.

I have another question now...I get a 1004 error on this line:

sheets(targetsheet).ChartObjects.Delete

Once again, only in 2007. I can comment it out and it seems to run
correctly but I can't find why this doesn't work.

Thanks again.

Bill

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
Type Mismatch... Darin Kramer Excel Programming 2 July 24th 06 02:07 PM
Type Mismatch: array or user defined type expected ExcelMonkey Excel Programming 4 July 6th 06 03:40 PM
Type mismatch using rnge as Range with Type 8 Input Box STEVE BELL Excel Programming 11 December 3rd 05 05:02 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 Donnie Fuqua Excel Programming 2 June 28th 05 03:29 AM


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