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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
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,215,467
Messages
6,124,984
Members
449,201
Latest member
Lunzwe73

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