excel - Conditional Formatting and text: Based on a condition I want to copy the format of another cell -


in excel

i trying copy elements , cell format of cell based on condition.

g12 = (if c10 = c11, *leave blank, if (c10>c11, *copy elements , format of b10, *copy elements , format of b11))

i've tried function , have had success copying elements, cannot formatting change well. used:

=if($c$10=$c$11,"",if($c$10>$c$11,b10,b11))

i learned conditional formatting don't see way copy format of cell based on condtion. color has specified.

thanks help!

tl:dr

march madness example

virginia beat unc 76 75

i want copy copy (1) virginia next spot in bracket lime green background. had unc won, want (16) unc , rose color copy next bracket spot

go vb-editor (alt + f11), insert new module , paste code:

function rangeselectionprompt(txt string) range     dim rng range     set rng = application.inputbox(txt, "select range", type:=8)      set rangeselectionprompt = rng end function  sub formatas()      dim sh worksheet     dim r1 range, r2 range     dim txt1 string, txt2 string     dim cel range, col range     dim val, check long, pos long      set sh = activesheet      txt1 = "enter range #1 - sourse"     txt2 = "enter range #2 - paste formats"      set r1 = intersect(rangeselectionprompt(txt1), sh.usedrange)     set r2 = intersect(rangeselectionprompt(txt1), sh.usedrange)       each cel in r2.cells          val = cel.value          if val <> ""              each col in r1.columns                  check = worksheetfunction.countif(col, val)                  if check > 0                     pos = worksheetfunction.match(val, col, 0)                      col.cells(pos, 1).copy                     cel.pastespecial paste:=xlpasteformats                  end if              next col          end if      next cel  end sub 

run once copy formats. you'll need define 2 ranges: enter image description here

source range (a:b) , range paste (f:g)


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -