Type mismatch

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top