Microsoft Office Forums Excel VBA font colour

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-10-2018, 07:08 AM
jams50 jams50 is offline Excel VBA font colour Windows 10 Excel VBA font colour Office 2010
Novice
Excel VBA font colour
 
Join Date: Dec 2018
Posts: 2
jams50 is on a distinguished road
Cool Excel VBA font colour

Can anyone help please with an excel VBA question?


I am on cell A1 and wish to start macro:
If font colour is red, change to black (automatic)
if font colour is not red, change to red i.e toggle between red and black.

Any advice appreciated.

Gus
Reply With Quote
  #2  
Old 12-10-2018, 07:47 PM
Kenneth Hobson Kenneth Hobson is offline Excel VBA font colour Windows 10 Excel VBA font colour Office 2016
Novice
 
Join Date: Jun 2018
Posts: 29
Kenneth Hobson is on a distinguished road
Default

Code:
Sub FontRedOrBlack()
  Dim c As Range
  Set c = [a1]
  With c
    Select Case .Font.Color
      Case vbRed
        .Font.Color = vbBlack
      Case Else
        .Font.Color = vbRed
    End Select
  End With
End Sub
Reply With Quote
  #3  
Old 12-11-2018, 03:48 AM
jams50 jams50 is offline Excel VBA font colour Windows 10 Excel VBA font colour Office 2010
Novice
Excel VBA font colour
 
Join Date: Dec 2018
Posts: 2
jams50 is on a distinguished road
Default Excel vba font colour

Kenneth,
Thank you very much for your help.
That one was way beyond my expertise.
Very grateful.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel VBA font colour Changing Font Colour & Style Tibsen21 Word 4 11-05-2018 03:10 PM
Excel VBA font colour Font colour & highlighting does not work DreamGirl Excel 2 02-13-2012 06:00 AM
Excel VBA font colour Font colour and format changing? Lamya Word 5 05-16-2011 02:35 AM
Font Size & Colour yparuk PowerPoint 0 10-07-2010 12:37 AM
font colour problems darro Outlook 0 11-25-2009 03:50 PM


All times are GMT -7. The time now is 07:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft