Hello lifeseeker1019,
Here is another method. This will copy the split rows and single rows to a different worksheet leaving the original data intact. However, it is design to operate only a single column. You can easily change the starting rows of the both the destination and source worksheet and the worksheet used for each. Both are set to start with cell "A2". This assumes there are headers in row 1.
![]()
Sub SplitIntoRows() Dim Cell As Range Dim DstRng As Range Dim R As Long Dim RegExp As Object Dim Rng As Range Dim RngEnd As Range Dim Wks As Worksheet Set Wks = Worksheets("Sheet1") Set Rng = Wks.Range("A2") Set DstRng = Worksheets("Sheet2").Range("A2") Set RngEnd = Wks.Cells(Rows.Count, Rng.Column).End(xlUp) If RngEnd.Row < Rng.Row Then Exit Sub Else Set Rng = Wks.Range(Rng, RngEnd) Set RegExp = CreateObject("VBScript.RegExp") RegExp.IgnoreCase = True RegExp.Pattern = "(.*)(Notes\:.*)" For Each Cell In Rng DstRng.Offset(R, 0) = RegExp.Replace(Cell, "$1") If RegExp.Test(Cell) Then R = R + 1 DstRng.Offset(R, 0) = RegExp.Replace(Cell, "$2") End If R = R + 1 Next Cell End Sub











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks