Barryj
10-31-2017, 09:13 AM
I have a userform which shows data from 2 columns, due to the varing length of the names displayed, the second column info which is a constant length of characters.
The info is displayed as the attached picture Messagebox. I would like the Expiry date info to always be on the right side of the messagebox as is on the attached Messagebox 2.
Is this possible with my current code?
Below is the code for the message box
Sub Message()
Dim msg As String, i As Long, a As Variant
msg = ""
For i = 1 To 2
For Each a In Array("AC")
msg = msg & Cells(i, a).Value & vbTab
Next a
msg = msg & vbCrLf
Next i
For i = 1 To 10
For Each a In Array("U", "V")
msg = msg & Cells(i, a).Value & vbTab
Next a
msg = msg & vbCrLf
Next i
For i = 1 To 10
For Each a In Array("W", "X")
msg = msg & Cells(i, a).Value & vbTab
Next a
msg = msg & vbCrLf
Next i
For i = 1 To 10
For Each a In Array("Y", "Z")
msg = msg & Cells(i, a).Value & vbTab
Next a
msg = msg & vbCrLf
Next i
For i = 1 To 10
For Each a In Array("AA", "AB")
msg = msg & Cells(i, a).Value & vbTab
Next a
msg = msg & vbCrLf
Next I
End Sub
Thanks for any advice or assistance
The info is displayed as the attached picture Messagebox. I would like the Expiry date info to always be on the right side of the messagebox as is on the attached Messagebox 2.
Is this possible with my current code?
Below is the code for the message box
Sub Message()
Dim msg As String, i As Long, a As Variant
msg = ""
For i = 1 To 2
For Each a In Array("AC")
msg = msg & Cells(i, a).Value & vbTab
Next a
msg = msg & vbCrLf
Next i
For i = 1 To 10
For Each a In Array("U", "V")
msg = msg & Cells(i, a).Value & vbTab
Next a
msg = msg & vbCrLf
Next i
For i = 1 To 10
For Each a In Array("W", "X")
msg = msg & Cells(i, a).Value & vbTab
Next a
msg = msg & vbCrLf
Next i
For i = 1 To 10
For Each a In Array("Y", "Z")
msg = msg & Cells(i, a).Value & vbTab
Next a
msg = msg & vbCrLf
Next i
For i = 1 To 10
For Each a In Array("AA", "AB")
msg = msg & Cells(i, a).Value & vbTab
Next a
msg = msg & vbCrLf
Next I
End Sub
Thanks for any advice or assistance