How do I Increase cell value in Excel using VBA? Error: Type mismatch
Posted
by John
on Stack Overflow
See other posts from Stack Overflow
or by John
Published on 2010-05-29T15:58:36Z
Indexed on
2010/05/29
16:02 UTC
Read the original article
Hit count: 164
I'm writing a macro, but because I'm working for first time in vb, I faced problems.
My code:
Cells (1, 1).Select
Dim tempvar As Integer
tempvar = Val(Selection.Value) // error
Selection.Value = tempvar + 1
What my code should be:
Cells(1,1).Value+=1
I get error "type mismatch". How do I accomplish that?
© Stack Overflow or respective owner