Happy friday everyone,
I've been scratching my head over this for the past week now and finally given up - hope someone more talented than me (which shouldn't be difficult) can suggest something.
Please bare in mind I'm a complete novice - I got this code by copying something someone had online and making simple modifications - thank you
The code does something simple - it arranges all rows bringing those with "Singapore" in column E to the top and pasted it in another worksheet. The issue now is there is a new format I'm dealing with - shown in below screenshot (there is now an additional row of comments which are always merged when pasted)
I'm trying to modify the code to bring the contents of the merged cells on to the right of the bolded rows - example of the desired result in image below
Sub CopySINGAPOREtoParsesheet()
Sheets("PASTEHERE").Select
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
Dim i As Long
Dim ws As Worksheet, nws As Worksheet
Set ws = ActiveSheet
LastRow = Cells(Rows.Count, "E").End(xlUp).Row
Dim wsName As String: wsName = "parse"
If (Worksheets("parse").Name = "") Then
Sheets("PASTEHERE").Copy After:=Sheets("PASTEHERE")
ActiveSheet.Name = "parse"
Range("A2:XFD" & LastRow).ClearContents
Else
Sheets("parse").Select
End If
Set nws = ActiveSheet
For i = 2 To LastRow
ws.Select
If UCase(Cells(i, "E")) = "SINGAPORE" Then
Range(("A" & i) & ":" & ("H" & i)).Copy
nws.Select
nsLR = Cells(Rows.Count, "A").End(xlUp).Row
Range("A" & nsLR + 1).Select
ActiveSheet.Paste
' Range("H" & i).Copy
' Selection.PasteSpecial Paste:=xlPasteValues
End If
Next i
Application.CutCopyMode = False
Application.ScreenUpdating = False
Application.DisplayAlerts = True
On Error GoTo 0
nws.Select
Range("A2").Select
For i = 2 To LastRow
ws.Select
If UCase(Cells(i, "E")) <> "SINGAPORE" And UCase(Cells(i, "A")) <> UCase(Cells(i, "E")) Then
Range(("A" & i) & ":" & ("H" & i)).Copy
nws.Select
nsLR = Cells(Rows.Count, "A").End(xlUp).Row
Range("A" & nsLR + 1).Select
ActiveSheet.Paste
' Range("H" & i).Copy
' Selection.PasteSpecial Paste:=xlPasteValues
End If
Next i
Application.CutCopyMode = False
Application.ScreenUpdating = False
Application.DisplayAlerts = True
On Error GoTo 0
nws.Select
Range("A2").Select
End Sub