View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson[_4_] Greg Wilson[_4_] is offline
external usenet poster
 
Posts: 218
Default 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
.