Buttons to change font colour

trevolly

Board Regular
Joined
Aug 22, 2021
Messages
64
Office Version
  1. 365
Platform
  1. Windows
Good Evening all.

I’m wondering if anyone can help a beginner with Excel. At work we use an excel spreadsheet that we write a daily log on to. We basically type text in to text wrapped cells for each event that happens on the airfield I work at. I would like to be able to make some custom buttons that will change the font colour after you’ve typed the event in to the cell / log. This font colour change would be after I have typed the text in to the cell. For example if there was an emergency on the airfield we would type up what happened, then select the cell (not highlight all the text in the cell) and then press the custom made button which would turn all the text in the selected cell red (and maybe bold).

If anyone could help I’d be very grateful.

Regards.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
37,546
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Assign this macro to the button...
VBA Code:
Sub TurnSelectedCellRed()
  Selection.Font.Color = vbRed
End Sub
 

JEC

Well-known Member
Joined
Aug 21, 2021
Messages
560
Office Version
  1. 365
Platform
  1. Windows
The macro recorder is your best friend
 
Solution

trevolly

Board Regular
Joined
Aug 22, 2021
Messages
64
Office Version
  1. 365
Platform
  1. Windows
Thank you v much I’ll give that a go.
 

johnnyL

Well-known Member
Joined
Nov 7, 2011
Messages
1,824
Office Version
  1. 2013
  2. 2007
Platform
  1. Windows
Two subroutines, one that you run to add a button, the other one will execute when you click the button.

After button has been added, just select a cell that you want to change and then click the button.

VBA Code:
Sub Add_Red_Text_Button_To_Active_Sheet()
'
    Dim WS  As Worksheet
    Dim oOLE As Excel.Button
'
    Set WS = Sheets(ActiveSheet.Name)                                                   ' <--- Change 'ActiveSheet.Name to another sheet name if desired
'
    Set oOLE = WS.Buttons.Add(Left:=350, Top:=35, Height:=18.75, Width:=150)     ' <--- Change settings to fit your needs
    oOLE.Caption = "Current Cell Red Text"
    oOLE.OnAction = "RedAndBold"
End Sub

Private Sub RedAndBold()
    With ActiveCell
    .Font.Color = vbRed
    .Font.Bold = True
    End With
End Sub
 

Forum statistics

Threads
1,147,635
Messages
5,742,244
Members
423,717
Latest member
rubthenut

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
Top