Match values in column C (Prod ID) in sheet 1

yuenja - Feb 14, 2018 at 09:25 AM

I hope you would be able to find time to help.

I have a situation whereby I have two sheets of data , call it Initial and Deactivate.
In each sheet the column labels are the same .

I want to match values in column C (Prod ID) in sheet 1(Initial) with values in column C (product id) in sheet 2 (Deactivate), and at the same time, exclude all values in column F (status) that is "Y-C" from sheet 2 (Deactivate) when I do the match.

After the matching, I just want to copy and paste the data associated with the newly matched column C as follows
from Sheet 2 (Deactivate) these - Column C (product id), Column A, Column M, column K, column M, column B, column D to a new sheet .

And in this new sheet I have a script to convert column C (product id) data to have commas separating the values out and again to output these values to a new row in a third sheet.

I got the VBA for the comma delimited as follows

Sub generatecsv()
Dim i As Integer
Dim s As String

i = 1

Do Until Cells(i, 1).Value = ""
If (s = "") Then
s = Cells(i, 1).Value
s = s & "," & Cells(i, 1).Value
End If
i = i + 1

Cells(1, 2).Value = s

End Sub

Many thanks in advance.
See more