Hi chaps.
I have the following code, that I want to loop through 5 variables (A to E). This then populates an address ready to process into word.
But it doesn't work, probably because a For loop has to loop numerically. I just wondered if there is a way to do what I want it to do??
So the end product would be... Addrs =
1st Line
2nd Line
3rd Line
City
Postcode
or
1st Line
3rd Line
City
Postcode
if B = ""
Cheers
Chris
I have the following code, that I want to loop through 5 variables (A to E). This then populates an address ready to process into word.
But it doesn't work, probably because a For loop has to loop numerically. I just wondered if there is a way to do what I want it to do??
Code:
Sub Macro1()Dim A As String
Dim B As String
Dim C As String
Dim D As String
Dim E As String
Addrs = ""
A = "1ST LINE"
B = "2ND LINE"
C = "3RD LINE"
D = "City"
E = "Postcode"
For i = A To E
If i <> "" Then
Addrs = Addrs & Chr(13) & Chr(9) & Chr(9) & Chr(9) & Chr(9) & Chr(9) & Chr(9) & i
End If
Next i
End Sub
So the end product would be... Addrs =
1st Line
2nd Line
3rd Line
City
Postcode
or
1st Line
3rd Line
City
Postcode
if B = ""
Cheers
Chris