Formatting cells with variable values

HaworthEstates

New Member
Joined
Jan 9, 2021
Messages
10
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
Hello there

I would like to find a VBA to format the cells ($A:$B), based on the values in $C and $D, which are variable, with the result in columns $E and $F, as per the below sample:

SourceDelaysDesired FontDesired ColorResult 1Result 2
John Doe 145BOLD#C00000John Doe 145
John Doe 238BOLD#C00000John Doe 238
John Doe 3-12Regular#000000John Doe 3-12
John Doe 4-40Regular#000000John Doe 4-40
John Doe 512Regular#FF66CCJohn Doe 512
John Doe 635Regular#FF66CCJohn Doe 635
John Doe 767BOLD#FF66CCJohn Doe 767
John Doe 8-4Regular#000000John Doe 8-4
John Doe 922BOLD#C00000John Doe 922
John Doe 1035BOLD#C00000John Doe 1035

Many thanks in advance.

Yours,
Haworth
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
How about
VBA Code:
Sub Haworth()
   Dim Cl As Range
   Dim Hex As String
   
   For Each Cl In Range("A2", Range("A" & Rows.Count).End(xlUp))
      With Cl.Resize(, 2)
         .Font.FontStyle = Cl.Offset(, 2).Value
         Hex = Right(Cl.Offset(, 3), 6)
         .Font.Color = RGB("&H" & Mid(Hex, 1, 2), "&H" & Mid(Hex, 3, 2), "&H" & Mid(Hex, 5, 2))
      End With
   Next Cl
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,147
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top