ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   makes a new list (https://www.excelbanter.com/excel-programming/296175-makes-new-list.html)

choice

makes a new list
 
i have a list of products, another list with products sold, i need to make a new list with list of products minus the products sold. ive been working with it, but i cant seem to get it.

thank you

Greg Wilson[_4_]

makes a new list
 
A VBA solution follows.

The following assumes the list of products and products
sold are in Columns A and B respectively starting in Cell
A2 and B2 with headings in A1 and B1. The new list will
be created in Column C stating in Cell C2 with C1 reserved
for a heading. Change references to suit and correct for
website word wrap.

Sub NewList()
Dim Rng1 As Range, Rng2 As Range, C As Range
Dim Rw1 As Integer, Rw2 As Integer, i As Integer

Rw1 = Range("A65536").End(xlUp).Row
Rw2 = Range("B65536").End(xlUp).Row
i = 1
Set Rng1 = Range("A2:A" & Rw1)
Set Rng2 = Range("B2:B" & Rw2)
For Each C In Rng1
If Rng2.Find(C, LookIn:=xlValues, LookAt:=xlWhole) Is
Nothing Then
i = i + 1
Cells(i, 3) = C
End If
Next

End Sub

Regards,
Greg
(VBA amateur)

-----Original Message-----
i have a list of products, another list with products

sold, i need to make a new list with list of products
minus the products sold. ive been working with it, but i
cant seem to get it.

thank you
.



All times are GMT +1. The time now is 09:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com