Excel VBA Search for Value in Column A Select Row Value is Found and Column F as Active Cell -


i vba newbie...

i looking value "a" in column a. use row number value "a" located at, , copy existing function in column f column e.

this tried , not work...

dim a_row long a_row = application.worksheetfunction.match("a", range("a:a"), 0) range("e" & a_row).select activecell.select activecell.offset(0, 5).select selection.copy activecell.offset(0, -1).select activesheet.paste 

thank in advance help!

in opinion, if going use vba avoid using worksheet functions unless totally necessary.

sub caroll()     dim ws worksheet     dim a_row long     dim rng range      set ws = activesheet     'loop through column     each rng in ws.range(ws.cells(1, 1), ws.cells(ws.rows.count, 1).end(xlup))         'test whether cell = "a","b", or "z"         if vartype(rng) <> vberror             if rng.value = "a" or rng.value = "b" or rng.value = "z"                 'if true copy column f of row column e                 rng.offset(, 5).copy rng.offset(, 4)             end if         end if     'loop     next rng   end sub 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -