Error 13 Type mismatch

G

Guest

Why am I getting type mismatch when I try to run this
little code? The value of cell O5 is a number produced by
a formula in the cell. What should I do?

Dim cell
Set cell = Range("o5").Value
MsgBox cell
 
C

Chip Pearson

Don't use the Set keyword in this code. E.g.,

cell = Range("O5").Value
MsgBox cell

or, use Set statement but don't use Value. E.g,

Set cell = Range("O5")
MsgBox cell.Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Top