Hi All,
I need some help to finish a VBA code for the output i need.
Two tables need to be partially merged into one. The values, format and comments of filled cells in the 'status' workbook must be copied into the 'update' workbook under the same ID (which is a unique identifier) and column. The output produced by this macro is supposed to be looking like the workbook "ViewOutput".
It seems my code is not mapping the filled cells using the ID.
Please find the attached sample data file for your reference.
Thank you for your help and assistance.
I need some help to finish a VBA code for the output i need.
Two tables need to be partially merged into one. The values, format and comments of filled cells in the 'status' workbook must be copied into the 'update' workbook under the same ID (which is a unique identifier) and column. The output produced by this macro is supposed to be looking like the workbook "ViewOutput".
It seems my code is not mapping the filled cells using the ID.
Please find the attached sample data file for your reference.
Thank you for your help and assistance.
Code:
Sub test1()
' Move cells with comments to target workbook
Dim i As Integer
Dim lngLetzteZeile As Long
Dim lngZielZeile As Long
Dim wksQ As Worksheet
Dim wksZ As Worksheet
Set wksQ = ActiveWorkbook.Worksheets("status") ' Source Workbook
Set wksZ = ActiveWorkbook.Worksheets("update") ' Target Workbook
lngLetzteZeile = wksZ.Cells(Rows.Count, 1).End(xlUp).Row
For lngZielZeile = 3 To lngLetzteZeile
For i = 5 To 11
If wksQ.Cells(lngZielZeile + 1, i).Interior.ColorIndex <> 2 Then
wksQ.Cells(lngZielZeile, i).copy Destination:=wksZ.Cells(lngZielZeile + 1, i)
End If
Next i
Next lngZielZeile
End Sub