Error 13 Type mismatch

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Hi
try
cell = Range("o5").Value

Use set only for object assignments
 
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
 

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