I'm working on a variation of this question:
Split single row into multiple rows based on cell value in excel
In the old question, the poster wanted a new row to start with each cell that contained a specific value. I'm wondering if there is any way to start a new row after a cell that contains a specific value?
I have adjusted the linked code for my use and it works perfectly, but it's creating a new row one cell too early for my data. The original question was about a year and a half old, and has an accepted answer so I didn't know if commenting on it would get a response.
If that's not correct protocol for the site I apologize. Any help would be greatly appreciated!
Dim rngColLoop As Range
Dim rngSheet1 As Range
Dim wksSheet2 As Worksheet
Dim intColCounter As Integer
Dim intRowCounter As Integer
Sheets.Add.Name = "Sheet2"
With Worksheets("2014-2633")
Set rngSheet1 = .Range(.Range("R1"), .Range("R1").End(xlToRight))
End With
Set wksSheet2 = Worksheets("Sheet2")
intRowCounter = 1
intColCounter = 0
wksSheet2.Range("A1").CurrentRegion.Clear
With rngSheet1
For Each rngColLoop In .Columns
If Trim(rngColLoop) <> "" Then
If (Trim(rngColLoop)) <> "TennesseeSigned" Then
intColCounter = intColCounter + 1
wksSheet2.Cells(intRowCounter, intColCounter) = rngColLoop
ElseIf (Trim(rngColLoop)) = "TennesseeSigned" Then
intRowCounter = intRowCounter + 1
intColCounter = 1
wksSheet2.Cells(intRowCounter, intColCounter) = rngColLoop
End If
End If
Next rngColLoop
End With
Set rngColLoop = Nothing
Set rngSheet1 = Nothing
Set wksSheet2 = Nothing