Hi guys,
I'm using the following code to combine the 6 cells below any cell with a top border on my worksheets into the top border cell using the Chr(10) feature of excel - All other cells which now contain no data are hidden.
I want to have a way of reversing this action, thereby taking the contents of each visible cell with a top border, and splitting it according to its contents. Where a Chr(10) character is used in the cell contents, place the value in the cell below. Complete for all cells on WS
Below is the code im using to combine.
Regards
Function D2(R, C, P, Q)
Dim i, j, k, x1, x2 As Integer
Dim BRow As Integer
Dim xRow As Integer
Application.ScreenUpdating = False
'*******************
'P 'Number of Rows To Delete
'Q 'Number of Rows To Combine
'*******************
If C >= 1 Then
If Cells(R, C).Borders(xlEdgeTop).LineStyle = xlContinuous Then
i = 0
Do Until Cells(R + i, C).Borders(xlEdgeBottom).LineStyle = xlContinuous
i = i + 1
Loop
BRow = R + i
j = (BRow - R) / 7
For k = 0 To j - 1
xRow = R + (k * 7)
If Cells(xRow, C).Value <> "" Then
x1 = 1
Do Until x1 = Q
If Len(Cells(xRow + x1, C)) <> "0" And Cells(xRow + x1, C).Value <> "Feedback:" Then
Cells(xRow, C).Value = Cells(xRow, C).Value & Chr(10) & Cells(xRow + x1, C).Value
Cells(xRow + x1, C).Interior.ColorIndex = xlNone
End If
x1 = x1 + 1
Loop
x2 = 1
Do Until x2 = P
Cells(xRow + x2, C).Value = ""
Cells(xRow + x2, C).Interior.ColorIndex = xlNone
x2 = x2 + 1
Loop
Bookmarks