Is there any easy or automatic way to update the rest of your code when renaming a particular variable in the Dim
line?
What I have:
Dim ABC As String
If Range("A2").Value = 1 Then
ABC = Range("C2") & ".xls"
ElseIf Range("A2").Value = 2 Then
ABC = Range("C2") & ".xlsx"
ElseIf Range("A2").Value = 3 Then
ABC = Range("C2") & ".xlsm"
Else
ABC = Range("C2") & ".txt"
End If
What I want:
Dim XYZ As String 'renomear ABC por XYZ
If Range("A2").Value = 1 Then
XYZ = Range("C2") & ".xls"
ElseIf Range("A2").Value = 2 Then
XYZ = Range("C2") & ".xlsx"
ElseIf Range("A2").Value = 3 Then
XYZ = Range("C2") & ".xlsm"
Else
XYZ = Range("C2") & ".txt"
End If