Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Type Mismatch... | Excel Programming | |||
Type Mismatch: array or user defined type expected | Excel Programming | |||
Type mismatch using rnge as Range with Type 8 Input Box | Excel Programming | |||
Help: Compile error: type mismatch: array or user defined type expected | Excel Programming | |||
type mismatch | Excel Programming |