Forum

Notifications
Clear all

Formatting Cells in Excel Text Boxes

7 Posts
3 Users
0 Reactions
72 Views
(@paul_f)
Posts: 81
Estimable Member
Topic starter
 

I'm using a text box with an = formula to capture a cell label (please see attached). I want the first letter of each word in the label to be larger to simulate MS Word's Small Caps font. While I can do this manually, the label will change depending on user selection, so I need a formula that will do the formatting.

Any ideas?

Paul

 
Posted : 01/08/2017 3:11 pm
Anders Sehlstedt
(@sehlsan)
Posts: 968
Prominent Member
 

Hello Paul,

As to my understanding you can do this by using VBA. I have not seen any formula that allows you to change the font size. The links below gives you more details of how to use the characters and font objects.

https://msdn.microsoft.com/en-us/error-creating-relationship-in-vba-userform-code/excel-vba/articles/characters-object-excel

https://msdn.microsoft.com/en-us/error-creating-relationship-in-vba-userform-code/excel-vba/articles/font-object-excel

Br,

Anders

 
Posted : 01/08/2017 3:41 pm
(@paul_f)
Posts: 81
Estimable Member
Topic starter
 

Thanks, Anders. I did see a post elsewhere that allowed the increase of a font size. I think it is something like this:

FontSize = .Font.Size
    ActiveCell.Characters(Start:=2).Font.Size = FontSize - 3.

The trouble (for me) is recognizing within VBA when the first character of the first, second, and third words begin (if there are second and third words, that is).

Paul

 
Posted : 01/08/2017 6:15 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Hi Paul

Instead of using a text box, you could try using a linked image instead.

I am using an Event macro to detect any change in a specific cell. via Data Validation

When you select from the list it will change the font size and will reflect in the linked image.

You may need to modify the codes to suit your situation.

Hope this helps.

Sunny

 
Posted : 01/08/2017 9:48 pm
(@paul_f)
Posts: 81
Estimable Member
Topic starter
 

That's a clever way.

 
Posted : 01/08/2017 11:06 pm
(@sunnykow)
Posts: 1417
Noble Member
 

Here is another version that can also change the color of the 1st letter of each word.

 
Posted : 02/08/2017 12:38 am
(@paul_f)
Posts: 81
Estimable Member
Topic starter
 

This just blows me away. Thanks!

 
Posted : 02/08/2017 2:16 am
Share: