vba - Change font in a cell based on a value -
i trying change font in range of cells depending on value of these cells. so, i'd change font of d1 depending on d1's value, , i'd change font of d2 depending on d2's value, , on d33.
i able find results how change font of cell depending on value of cell here. vba code did job d1 only. however, did not work d2, d3, d4 , on.
could me adjust code need?
i apologize if question easy answer, i'm not familiar how vba coding works.
this code you've described, in case applying font text in column c based upon special characters mention in column d (notice i'm using 1 rather "1", etc...). if column d doesn't contain of characters, assumes desired font name in column d -- did provide test of code. of course, you'll need modify code particular situation, gets started.
option explicit sub fontchange() dim therange range, cell range set therange = range("c1:c16") each cell in therange select case cell.offset(0, 1) case 0, 1, "(": cell.font.name = "wingdings 2" case "", ":": cell.font.name = "wingdings" case else: cell.font.name = cell.offset(0, 1) end select next end sub
in animated gif step through code can see working.
Comments
Post a Comment