0
votes

I need to compare a sheet (which has 4k date) with another sheet and say 'yes' or 'no'.tried to use

ifSheets(j).Range("A2").Text = Sheets(1).Range("A2").Text Then 'Write 4 in sheet1 cell C6 when the two values are coinciding. Sheet1.Range("C6") = 4 from site, Comparing two text cells in different sheets but couldn't succeed. tried for 4 days without success so finally thought to ask help

what i try to do is compare sheet 1 range A with a specific value/text in "B2" on sheet 2, sheet 1 range A has about 4k data. if it finds a match I need "B3" to show "Y", if it doesn't find a match "N". idea is simple but I really need help please...

1

1 Answers

0
votes
sub main
dim i as integer
for i = 1 to 4000
    if sheet1.cells(i, 1) = sheet2.cells(2, 2) then 
        sheet2.cells(3,2 ) = "Y"
        exit sub
    end if
next i

sheet2.cells(3, 2) = "N"
end sub