What i am trying to do is copy large amounts of data from a big report (called new report for this question) into the master report.
The code below works fine when there is only one row to get the data from. However, not sure what to do when there are multiple rows with the same ID as its only looking at the first line and not all the rows. Why is this a problem? Because sometimes the below condition does not get fulfilled on the first line (shown in the code below)
NewReportCell.Offset(0, -93).Value = "-" And _
NewReportCell.Offset(0, -142) = "YES" Then
Sub Interactv4(Optional ByDummy As Byte)
Dim PK As Variant
Dim Concat As String
Dim RowCount As Long
Dim nextrow As Long
Dim tC As String 'tC should represent the column with the concatenate in it
Dim col(1 To 8) As String
Dim loc As Range
Dim NewReportCell As Range
PK= loc.Offset(0, 2).Value
If loc.Offset(0, 2).Value = "Not Available" Then
loc.Offset(0, 80) = "Y"
Else
loc.Offset(0, 80) = "N"'Line items from the new report
RowCount = WorksheetFunction.CountIf(NewReport.Range("FW:FW"), PK)
Set NewReportCell = NewReport.Range("FW:FW").Find(PK, lookat:=xlWhole)
If RowCount = 1 And _
NewReportCell.Offset(0, -93).Value = "-" And _
NewReportCell.Offset(0, -142) = "YES" Then
'A large amount of data is copied from the daily report based on the primary key given above
Now, to isolate those rows where there are multiple rows with the same ID, i add the following. However, it's not doing its job as in its still only copy pasting from the first row. Any help will be appreciated.
Else
If RowCount > 1 And _
NewReportCell.Offset(0, -93).Value = "-" And _
NewReportCell.Offset(0, -142) = "YES" Then