es2008
09-10-2008, 12:30 PM
Hi,
I am trying to get a column of data:
Column A
1
2
3
4
5
and have it send the data as value in one string separated by comma and with single quotes around each data.
Coumn A
'1','2','3','4','5'
I came up with this but it isn't working properly:
Range("b1").Select
Dim row As Integer
Dim entry, ending As String
Dim the_end As Boolean
row = 1
the_end = False
While the_end = False
ending = Range("a" & row).Value
If ending = "end" Then
the_end = True
Else
entry = entry & "' ,'" & Range("a" & row).Value
End If
row = row + 1
Wend
Range("a" & row).Value = entry
Results come out like this:
,'1','2','3','4','5
It starts with a comma and doesn't end properly with a single quote.
Help.
I am trying to get a column of data:
Column A
1
2
3
4
5
and have it send the data as value in one string separated by comma and with single quotes around each data.
Coumn A
'1','2','3','4','5'
I came up with this but it isn't working properly:
Range("b1").Select
Dim row As Integer
Dim entry, ending As String
Dim the_end As Boolean
row = 1
the_end = False
While the_end = False
ending = Range("a" & row).Value
If ending = "end" Then
the_end = True
Else
entry = entry & "' ,'" & Range("a" & row).Value
End If
row = row + 1
Wend
Range("a" & row).Value = entry
Results come out like this:
,'1','2','3','4','5
It starts with a comma and doesn't end properly with a single quote.
Help.