criminal_ginger
New Member
- Joined
- Aug 17, 2023
- Messages
- 9
- Office Version
- 2019
- Platform
- MacOS
I am using a macro I found online to concatenate data into groups as shown here: How to concatenate cell values until if finds a blank cell in a column?
The macro is as follows:
I have about 61,000 rows of data that I am trying to use this function on, but it only outputs the data for about 3,900 rows. Is there anything I can adjust to make this work properly? I am very new to VBA, and I'm completely confused.
The macro is as follows:
VBA Code:
Sub Concatenatecells()
'updateby Extendoffice
Dim xRg As Range
Dim xSaveToRg As Range
Dim xTxt As String
Dim xCell As Range
Dim xTStr As String
On Error Resume Next
xTxt = ActiveWindow.RangeSelection.Address
Set xRg = Application.InputBox("Please selecte the data range:", "Kutools for Excel", xTxt, , , , , 8)
If xRg Is Nothing Then Exit Sub
If xRg.Columns.Count > 1 Then
MsgBox "the selected range is more than one column", vbInformation, "Kutools for Ecel"
Exit Sub
End If
Set xSaveToRg = Application.InputBox("Please selecte output cell:", "Kutools for Excel", , , , , , 8)
If xSaveToRg Is Nothing Then Exit Sub
Set xSaveToRg = xSaveToRg.Cells(1)
Application.ScreenUpdating = False
For Each xCell In xRg
If xCell <> "" Then
xTStr = xTStr & xCell & " "
Else
xSaveToRg.Value = xTStr
Set xSaveToRg = xSaveToRg.Offset(1)
xTStr = ""
End If
Next
If xTStr <> "" Then xSaveToRg.Value = Left(xTStr, Len(xTStr) - 1)
Application.ScreenUpdating = True
End Sub
I have about 61,000 rows of data that I am trying to use this function on, but it only outputs the data for about 3,900 rows. Is there anything I can adjust to make this work properly? I am very new to VBA, and I'm completely confused.