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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -