Button Click Changing Specific Text in Specific Cells

lockarde

Board Regular
Joined
Oct 23, 2016
Messages
77
Evening all,

I'm working on a schedule for my boss, and I'd like to add a button that when clicked, changes the format of specific text in specific cells. This is for Time off, so say I have 3 days selected, and want to change "John" to have RED font, strikethrough the text, and increase font size to 18. This way, my boss can clearly see who has requested, and been given time off. I assumed "ActiveCell" would be the easiest way to go about this, but I'd need to select from a range of 5 employees, lets call them John, Sue, James, Trevor and Steve, and I'm having difficulty getting this right.

Any help is greatly appreciated!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Try this:
You can select one or more cells at once

Code:
Sub My_Time_Off()

    With Selection.Font
        .Size = 18
        .Strikethrough = True
        .Color = vbRed
    End With
End Sub
 
Last edited:
Upvote 0
Thanks for the response!! This doesn't work however; I get Error 1004 "Unable to set size property of Font Class"

This also doesn't allow me to choose which specific name I'd like to change. Ideally, I would have specific days (cells) selected and then select name(s) to be changed within those days, click the button and the font is changed. Maybe this is too much of a PIA to do with one button? I could use a button for each name I suppose?
 
Upvote 0
I fixed the error, I realized I had the sheet protected. The rest still stands though, is there a way to select which text gets changed within the cells?
 
Upvote 0
How is it determined what text to change in the cells?
 
Upvote 0
That is my discretion, it's for a time off button; so say "John" wants Nov 23 off, then I can select that cell, choose John and then the button will change the font. I reckon a drop down menu might work?
 
Upvote 0
So you would select the name from a dropdown, select the cells and then press the button to do the formatting?
 
Upvote 0
Been fiddling around with simply using five check boxes instead of a drop down menu, I'm just not sure how to get them to work in tandem with the button? What I imagine: You check name(s) and then select cells, click the button and it change the font of the names that are selected.
 
Upvote 0
So your saying you select a cell that says John is a nice person and you want to select just "John" and then just change John to the color "Red" "Strike Through" "Font size 18 and font type is that what your wanting?
And my previous script did all that on all the text in the cell except for the font name because you did not say what font name.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,874
Members
452,363
Latest member
merico17

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