vlookup in reverse
Assume you Vlookup looks as A1:F10 of the activesheet using the value in
Textbox1. Then to alter the cell in column A that matches the value in
Textbox1:
Dim rng as Range, rng1 as Range, res as Variant
set rng = Range("A1:A10")
res = Application.Match(Userform1.Textbox1.Text,rng,1)
if not iserror(res) then
set rng1 = rng(res)
rng1.clearcontents
end if
to alter the value in column E (column 5) of that row
Dim rng as Range, rng1 as Range, res as Variant
set rng = Range("A1:A10")
res = Application.Match(Userform1.Textbox1.Text,rng,1)
if not iserror(res) then
set rng1 = rng(res,5)
rng1.clearcontents
end if
--
Regards,
Tom Ogilvy
"Newbie" wrote:
Hi,
I need to change the value of cells found via application.vlookup in vba
Is there a simple way to do this from a userform?
Thanx
|