Hey, guys!
I'm struggling with a little challenge. I have a list of entries in Column A, in each cell there are 2-3 words, around 17 000 rows in whole column, and 160 000 characters in whole column. I need to take each cell in Column A and put them into a comma-separated list.
So if Column A looks like this:
Cow
Apple
Cider
Banana
I need a macro that would make it into: Cow, Apple, Cider, Banana
I found the following macro online:
Sub generatecsv()
Dim dataRow As Integer
Dim listRow As Integer
Dim data As String
dataRow = 1: Rem the row that it is being read from column A otherwise known as 1 in vb script
listRow = 1: Rem the row in column B that is getting written
Do Until Cells(dataRow, 1).Value = "" And Cells(dataRow + 1, 1).Value = ""
If (data = "") Then
data = Cells(dataRow, 1).Value
Else
If Cells(dataRow, 1).Value <> "" Then
data = data & "," & Cells(dataRow, 1).Value
Else
Cells(listRow, 2).Value = data
data = ""
listRow = listRow + 1
End If
End If
dataRow = dataRow + 1
Loop
Cells(listRow, 2).Value = data
End Sub
It stores resulting list in a cell (B1). The problem is that since I have more than 160 000 characters in the column, it exceeds Excel's cell character limit of 32 767.
Is there way to store result in clipboard maybe or some other workaround?
Bookmarks