Import a CSV file HELP

M

melissad

I am not sure if this in the right forum, but I need help.

OK I have two spreadsheets. One spreadsheet (out of stock) shows model
numbers that have been taken out of stock. The other spreadsheet
(stock) shows the same model numbers and a quantity field.

I need to be able to make the model numbers from the out of stock
spreadsheet to be filtered (?) in to my stock spreadsheet and recognize
which items are out of stock and change the quanity field to zero.

right now the stock spreadsheet has a model # column and a product
quantity column, the model # column has numbers in the the product
quantity has the number 20 in it all the way down. I should mention
there are 6000 rows in the stock spreadsheet.

How can I accomplish this??

Thank you. If I didnt explain it right, please ask questions.

Melissa
 
T

Tom Ogilvy

This untested code should get you started. Adjust names and sheet references
to fit your actual situation.

Assumes Product Numbers are in column A starting in row 2 and for the Stock
sheet, the quantities are in column B.

Sub ABC()
Dim rng as Range, rng1 as Range
Dim cell as Range
with Workbooks("Stock.CSV").Worksheets(1)
set rng = .Range(.Cells(2,1),.Cells(rows.count,1).End(xlup))
End with
With workbooks("Out of Stock.csv").Worksheets(1)
set rng1 = .Range(.Cells(2,1),.Cells(rows.count,1).End(xlup))
End with

for each cell in rng
if application.Countif(rng1,cell) > 0 then
cell.offset(0,1).Value = 0
end if
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top