Hi,
I have this macro which looks for the unit 'ps' in Column Y and multiplies 1E+12 with the corresponding data in column AC. When it tries to multiply 1E+12, it throws a type mismatch error.
Below is the code.
What am I missing here??
Thanks,
P11
I have this macro which looks for the unit 'ps' in Column Y and multiplies 1E+12 with the corresponding data in column AC. When it tries to multiply 1E+12, it throws a type mismatch error.
Below is the code.
Code:
Sub Multiply_Tdata()
'
' Change the value of the data (AC) column - multiply by 1E+12
'
'
Dim sFind As String, sAddr As String
Dim rRng As Range, rCl As Range, rFnd As Range
sFind = "ps" '<-could use InputBox
Set rRng = Range("Y1:Y27000")
With rRng
Set rCl = .Find(sFind, LookIn:=xlValues)
If Not rCl Is Nothing Then
sAddr = rCl.Address
Do
If rFnd Is Nothing Then
Set rFnd = rCl
Else: Set rFnd = Union(rCl, rFnd)
End If
Set rCl = .FindNext(rCl)
Loop While Not rCl Is Nothing And rCl.Address <> sAddr
Else: MsgBox "Cannot find " & sFind
GoTo exit_proc
End If
End With
' Debugger throws a type mismatch error on below line
rFnd.Offset(, 4) = rFnd.Offset(, 4).Value * 1000000000000
exit_proc:
End Sub
What am I missing here??
Thanks,
P11