I am trying to loop through cells in ColumnA to find a start point and end point, then copy all rows between these anchors, transpose the data set, and then continue looping through the rest of the cells and do the same.
I came up with this, but I know it's not even close to working.
Sub TryThis()
Dim LastRow As Integer
Dim startcell As Range
Dim endcell As Range
Sheets("Sheet1").Select
LastRow = ActiveSheet.Range("A1000000").End(xlUp).Row
Set startrng = Range("A1:A" & LastRow)
With Worksheets(1).Range(startrng.Address & ":" & Cells(LastRow, startrng.Column).Address) '<== set the start search range here
Set startcell = .Find(What:="class: pipestandardize.Standardize")
End With
With Worksheets(1).Range(startcell.Address & ":" & Cells(LastRow, startcell.Column).Address) '<== set the end search range here
Set endcell = .Find(What:="id: standardize")
End With
' Range("A10:A100,A150:A330,A380:A420").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1").End(xlUp).Select
lMaxRows = Cells(Rows.Count, "A").End(xlUp).Row
Range("A" & lMaxRows + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Sheets("Sheet1").Select
End Sub
Basically, I want to select all rows from the starting point of class: pipestandardize.Standardize
to the ending point of id: standardize
, copy this range, and transpose it and paste it.
Then, from the cell after id: standardize
, start looping through cells again, to find the next starting point that contains class: pipestandardize.Standardize
and go down to the ending point that contains id: standardize
, select this range, copy and transpose/paste under the previous one.