Why Type "Mismatch"???

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

Guest

Are there anybody who with experienced eyes can see the cause of the error?

I use one sheet as a "storage" or template for formulas and they are like a
ordinary formula pointing at specific excel cells etc. I have only deleted
the "=" in the beginning.

I try to reconstruct a formula now and use in vba like Sample code:

Sub RestoreFormulas ()
Set Sheet118.Range("C29:G48").Cells.Formula = "=" & Sheet203.Range
("C29:G48").Cells.Value
End Sub

A typical template formula in one cell is: NkSc2!$D$29-NkSc1!$D$29
but that doesn't matter, I guess

Sheet 203 is actually a paste copy of sheet118, so the excel sheet formats
is identical. Why do I get type mismatch in the code above???

/Regard
 
Remove "Set".

Set is only used for objects (a range, a worksheet). The Formula property
isn't/doesn't expect an object, so you get a mismatch.

Since the value you are trying to assign to Formula isn't an object either,
all you probably need to do is remove "Set" and the compiler should be able
to do what you ask (or at least give you a different flavor of error
message). :-)

HTH,

George Nicholson

Remove 'Junk' from return address.
 

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

Similar Threads


Back
Top