Help my please: VBA code for "Find" function

E

emil

I have two columns in diferent Sheets.

A
1 Acidophilus with Psylium (100 capsule)
2 AC-Zymes (100 capsule)
3 Beta Carotene (100 capsule gelatinoase)
4 Chelated Zinc (100 tablete)
5 Full Spectrum (90 tablete)
Sheet1

A
1 Chelated Zinc (100 tablete)
2 …………………………….
3 Acidophilus with Psylium (100 capsule)
4 ……………………………………
5
Sheet2


I want to find and select in Sheet2 the content from one or other
Sheet1 cells, using a VBA code. eg: Fiind in Sheet2.Column(A:A) the content
of Sheet1.Range(A4)
Thanks in advance

Emil
 
J

joel

with sheets("Sheet1")
LastRow = .Range("A" & Rows.Count).end(xlup).Row
ForRowCount = 1 to LastRow
Itm = .Range("A" & RowCount)
with Sheets("Sheet2")
set c = .Columns("A").Find(what:=Itm, _
lookin:=xlvalues, lookat:=xlwhole)
if c is nothing then
msgbox("Could not find : " & itm)
else
'c is the cell with the matched item
end With

Next RowCount
end with
 
E

emil

Thank you very, very, very much
Emil
joel said:
with sheets("Sheet1")
LastRow = .Range("A" & Rows.Count).end(xlup).Row
ForRowCount = 1 to LastRow
Itm = .Range("A" & RowCount)
with Sheets("Sheet2")
set c = .Columns("A").Find(what:=Itm, _
lookin:=xlvalues, lookat:=xlwhole)
if c is nothing then
msgbox("Could not find : " & itm)
else
'c is the cell with the matched item
end With

Next RowCount
end with
 

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