excel - Keep textformatting with vlookup -
is there way use vlookup excel , keep formatting of text?
in case rows want copy vlookup sheet formatted different colors. want keep these colors.
as rory pointed in comment, not possible achieve vlookup. can use .find
, .copy
method , receive effect need. below posted sample code. can use copy/paste depending on needs.
sub paste_formats() dim find string on error goto blad: find = range("c3:c19").find(range("a1").value).address range(find).copy destination:=range("b2") exit sub blad: if err.number = 91 then: msgbox ("value not found.") 'if value not found pop message. end sub
if want copy rows need change code bit:
find = range("c3:c19").find(range("a1").value).row rows(find & ":" & find).copy destination:=rows(23)
in case want copy formatting should use copy / pastespecial xlpasteformats.
Comments
Post a Comment