View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default How to code macro with if condition?

Sub eric001()
v = Sheets("Temp").Range("B15").Value
Set myCell = Range("A1")
If InStr(1, v, "M") Then
v = Replace(v, "M", "")
Else
If InStr(1, v, "B") Then
v = Replace(v, "B", "") * 1000
End If
End If
myCell.Offset(0, 3).Value = v
End Sub

--
Gary''s Student - gsnu200773