A data set provided me is space separated but a few cells have an intentional space in them, violating the space separation rule.
In this case, the value "00C" always found in column 2, sometimes has an embedded space.
The cell contents should have the format "00C 123456" but the import broke the contents across two cells.
When "00C" is found as the complete contents in column 2, it must be combined with a space followed by the contents of column 3, then everything from 4 to the end is moved left one column.
I cannot find the right syntax to use in the For Each statement, and in the code to select the range, within one row, from column 4 to the end and paste that range back into the row beginning with column 3.
I always try to use row, column format rather than A2 or AB3 format so please try to go that way.
Thank you for your time.
In this case, the value "00C" always found in column 2, sometimes has an embedded space.
The cell contents should have the format "00C 123456" but the import broke the contents across two cells.
When "00C" is found as the complete contents in column 2, it must be combined with a space followed by the contents of column 3, then everything from 4 to the end is moved left one column.
I cannot find the right syntax to use in the For Each statement, and in the code to select the range, within one row, from column 4 to the end and paste that range back into the row beginning with column 3.
I always try to use row, column format rather than A2 or AB3 format so please try to go that way.
Thank you for your time.
VBA Code:
Sub fix_00C_space()
Dim found As bool
Dim current_row As Long ' replace this with the current row number from the For Each statement, I don't know what that is.
For Each row in this_sheet
If (.cell(current_row, 2) = "00C") Then
.cell(current_row, 2) = "00C " & .cell(current_row, 3)
move_columns_4_through_end_to_the_left_by_one_column()
End If
Next
End Sub