I'm trying to organise sections into a tabular form as shown.
My attempt is not great but was wondering if someone has something available.
Code is in workbook but probably not correct to begin with.
Capture.PNG
I'm trying to organise sections into a tabular form as shown.
My attempt is not great but was wondering if someone has something available.
Code is in workbook but probably not correct to begin with.
Capture.PNG
Or the following.
Capture2.PNG
Is this a 2-dimensional array situation?
This seemed to work.
![]()
Sub organise() Dim RowNumber, NewRowNumber As Long Dim ColumnNumber As Long Dim SectionText As String Dim SectionCounter As Long Dim NumberOfEntries As Long Dim Section As Variant NumberOfEntries = Application.WorksheetFunction.CountA(Range("A:A")) ReDim Section(0 To NumberOfEntries - 1) SectionCounter = 0 RowNumber = 1 NewRowNumber = 4 ColumnNumber = 9 Do Until SectionCounter = NumberOfEntries If Len(Cells(RowNumber, 1)) > 0 Then Section(SectionCounter) = Cells(RowNumber, 1).Value If SectionCounter > 0 Then If Section(SectionCounter) <> Section(SectionCounter - 1) Then ColumnNumber = ColumnNumber + 1 NewRowNumber = 4 End If End If Cells(NewRowNumber, ColumnNumber).Value = Cells(RowNumber, 2).Value SectionText = Cells(RowNumber, 1).Value NewRowNumber = NewRowNumber + 1 SectionCounter = SectionCounter + 1 End If RowNumber = RowNumber + 1 Loop End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks