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

This is an extract from my macro:

For m = 2 To 20
.Cells(k + 2, m).Value = .Cells(k, m) - .Cells(k + 1, m)

I get a type mismatch, I think that a lot of cells in the worksheet I'm
evaluating
are words.
How do I rectify this? Help is greatly appreciated


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Type mismatch

Maybe something like

For m = 2 To 20
.Cells(k + 2,m).Value = IIf(IsNumeric(.Cells(k, m) Value), Cells(k,
m) .Value, 0) - _
IIf(IsNumeric(.Cells(k + 1,
m).Value), .Cells(k + 1, m).Value, 0)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"teresa" wrote in message
...
This is an extract from my macro:

For m = 2 To 20
.Cells(k + 2, m).Value = .Cells(k, m) - .Cells(k + 1, m)

I get a type mismatch, I think that a lot of cells in the worksheet I'm
evaluating
are words.
How do I rectify this? Help is greatly appreciated




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 [email protected] Excel Worksheet Functions 1 May 16th 07 03:29 PM
Type Mismatch Jack Schitt Excel Programming 2 September 3rd 04 11:55 AM
Type mismatch Stuart[_5_] Excel Programming 4 February 19th 04 07:54 PM
Type Mismatch Edgar[_3_] Excel Programming 4 February 13th 04 03:55 PM
Type mismatch Steve Garman Excel Programming 0 February 5th 04 07:39 AM


All times are GMT +1. The time now is 12:46 AM.

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"