I am trying to create a code where i loop through three types of worksheets and copy rows of data in a dynamic range in those sheets and paste it in the mastersheet. Part of the data i'm copying needs to be pasted to column D of my master worksheet in a running list (i.e., data should not overwrite each other and should create a list in column D). The other part of the data in a copied row will not be in column D in the master worksheet but need to be in the same row as the data in column D.

I've been able to do it for two of my type of worksheets(let's call them a and b), but not my third one (worksheet c). The issue is that for worksheets a and b is that the data in worksheet a match the columns i am pasting them to in the mastersheet. For worksheet c, that is not the case, so part of my data is being pasted in a row different from the rest of the worksheet c data. Finding the dynamic range to be pasted over was slightly harder for worksheet c as well. I knew the column and the last row constraint, but not the starting row, which you'll see in the code
Please help!!
Dim ws As Worksheet
Dim targetws As Worksheet
Dim LastRow As Long
Dim openitemstartrow As Variant
LastRow = Cells(Rows.Count, "D").End(xlUp).Row
Set targetws = Sheets("targetwsname")
For Each ws In ActiveWorkbook.Worksheets
'this is the copy paste command for worksheet a
If ws.Name Like "*" & "WorksheetA" & "*" Then
ws.Range("C4:G" & ws.Range("D" & Rows.Count).End(xlUp).Row).Copy
Destination:=targetws.Range("D" & Rows.Count).End(xlUp).Offset(1)
Else
'this is the copy paste command for worksheet b
If ws.Name Like "*" & "WorksheetB" & "*" Then
ws.Range("C4:I" & ws.Range("D" & Rows.Count).End(xlUp).Row).Copy
Destination:=targetws.Range("D" & Rows.Count).End(xlUp).Offset(1)
End If
'this is the code for worksheet c
If ws.Name Like "*" & "WorksheetC" & "*" Then
'to find the starting row number for the range i want to copy and paste
openitemstartrow = Application.Match("Open Items:", ws.Range("C:C"), 0)
'cell c4 indicates whether this is anything to copy paste from worksheet c
If Not IsEmpty(ws.Cells(4, "C")) Then
'have to copy and paste range as values in my masterworksheet to ignore formulas
ws.Range("C" & openitemstartrow + 1, ws.Range("C" & openitemstartrow + 10).End(xlUp)).Copy
ws.Range("C" & openitemstartrow + 1, ws.Range("C" & openitemstartrow + 10).End(xlUp)).PasteSpecial Paste:=xlPasteValues
'this is the part of code i am struggling with. the range from column C of the worksheet c pastes correctly but i need the range from columns K and L of the worksheet c to paste to the same row as my column C data.
ws.Range("C" & openitemstartrow + 1, ws.Range("C" & openitemstartrow + 10).End(xlUp)).Copy
targetws.Range("D" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
ws.Range("E" & openitemstartrow + 1, ws.Range("F" & openitemstartrow + 10).End(xlUp)).Copy
targetws.Range("K" & Rows.Count, "L" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
End If
End If
End If
'End If
Next ws
End Sub