Excel: Type Mismatch error in VBA
Getting a Type Mismatch error on the line in Red, any ideas why? But if I take out the * 1.4503 it will take the value from Cell (0, 5) and put it in Cell (0, 9)
VB Code:
Sub Macro3()
Dim MyCell3 As Range
For Each MyCell3 In Sheet1.Columns("D").Cells
With MyCell3
If .Value = "" Then Exit For
If .Value <> "OMI" Then
[COLOR=Red].Offset(0, 9).Value = .Offset(0, 5).Value * 1.4503[/COLOR]
Else
.Offset(0, 9).Value = .Offset(0, 5).Value
End If
End With
Next MyCell3
End Sub
Re: Excel: Type Mismatch error in VBA
I guess that Value is a string then, in which case you can use code like this:
VB Code:
.Offset(0, 9).Value = CStr(CSng(.Offset(0, 5).Value) * 1.4503)