To find value if it is in the name range - Microsoft Community


hi

i have set name range in sheet2, column , find if value or text in column in sheet1, uf, otherwise mf.

the following code , please advise how fix doesn't work.  function appropriate use, match or find...

[code]

sub sbnamerange()
dim integer
dim j integer
dim t long
dim lastrow long
dim underlying string

'adding name
names.add name:="underlying", refersto:="=sheet2!$a$1:$a$4"

lastrow = sheets("sheet1").cells(rows.count, 1).end(xlup).row

sheets("sheet1").select
= 1 lastrow
j = 1 lastrow

t = application.match(worksheets("sheet1").cells(i, j).value, worksheets("sheet2").[underlying])

if not iserror(t) then
    worksheets("sheet1").cells(i, 6).value = "uf"
else
    worksheets("sheet1").cells(i, 6).value = "mf"
end if

next j
next i

end sub

[/code]

hi bill,

thank kind feedback.

in order close thread, , assist others may search forum archives solution similar problem, ask kindly mark response answer.

===

regards,

norman



Office / Excel / Microsoft Office Programming / Office 2010



Comments

Popular posts from this blog

Getting ErrorCode: 120018 when trying to access Microsoft account - Microsoft Community

The message was sent to a distribution list ‎(DL)‎ - Microsoft Community

Activation Error 0x8004FE93 - Microsoft Community