1

Sorry if this is a dumb question but still fairly new to VBA.

I'm building a daily schedule sheet, and as part of it want to be able to color code high and low priority appointments. Rather than having to manually adjust the color and bold each one, I want to run a macro with a shortcut key to modify the cells I've selected.

I have the color/bold part figured out, but am having trouble telling it to apply the changes the cells I have selected. Any help would be greatly appreciated.

Sorry, the code is-

Sub HighPriority() 

HighPriority Macro

    Range("AE27:AP27").Font.Color = RGB(255, 0, 0)
    Range("AE27:AP27").Font.Bold = True
End Sub

So instead of it always editing AE27:AP27, I would want it to apply the changes to whichever cells I have selected.

Community
  • 1
  • 1
Lupi
  • 33
  • 1
  • 5

1 Answers1

2

After Select ing your cells, run something like:

Sub ColorMe()
    With Selection
        .Interior.ColorIndex = 27
        .Font.Bold = True
    End With
End Sub
Gary's Student
  • 95,722
  • 10
  • 59
  • 99
  • Thank you! That got it working with the current cell selection, just had to update it to do the font in the color I wanted. – Lupi Feb 02 '15 at 16:47
  • 3
    One of the few times you might NOT [avoid using select](http://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba-macros) – Chrismas007 Feb 02 '15 at 17:09
  • @Chrismas007 I agree with you completely.....working within VBA, **Selection** should usually be avoided; but it is not a bad way to work with a Human User. – Gary's Student Feb 02 '15 at 17:24