IF THEN ELSE question
Hi,
I have following code:
Sub auto()
Dim txt As String
Range("A3").Formula = "=mid(trim(a2),16,5)"
txt = Range("A3").Value
If txt = "TRIAL" Then
Application.Run ("text2colGL")
Else
If txt = "AR AG" Then
Application.Run ("txt2colAR")
Else
Application.Run ("text2col")
End If
End If
End Sub
How can I avoide placing the mid/trim function in cell A3.
If I use:
text = mid(trim(range("A2"),16,5)
it doesn't give me the same value.
Cheers,
Harold
|