Check to see if cell value exists

M

Mark

I am using Excel 97 and want to be able to check to see if
a cell value on one sheet is already listed in a range on
another sheet.

If the cell value is listed then move to the next cell
down, if not listed then copy the value of that cell into
the next cell available in the range on the sheet.

Can anyone assist with some code please?

Thanks

Mark
 
G

Guest

I can't find anything suitable in my HELP, I did try this
first!

Can anyone else offer any more suggestions/code, please?
 
R

Ron de Bruin

Try this

It will look in each cell in Sheets("Sheet1").Range("a1:a10")
If a cell value not exist in Sheet2 in column A it will copy the cell to the
next available cell in sheet2 column A


Sub Copy_test()
For Each cell In Sheets("Sheet1").Range("a1:a10")
If Application.WorksheetFunction.CountIf(Sheets("sheet2").Range("A:A") _
, cell.Value) = 0 Then
cell.Copy Sheets("sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 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