Solved

Excel 2010:  .VBA Code for Bolding Text

Posted on 2013-02-01
10
263 Views
Last Modified: 2013-02-04
I have a macro that uses "vbred" color to highlight items in my spreadsheet.  Is there a way to bold this?   i.e. "vbred bold"  Thanks.
0
Comment
Question by:itsmevic
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 13

Expert Comment

by:Shanan212
ID: 38844568
Considering your items are selected prior to coloring them

Selection.Font.Bold = True

Open in new window

0
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 166 total points
ID: 38844572
Just add


    Range.Font.FontStyle = "Bold"
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38844574
Hi, itsmevic.

myCell.Font.Bold = True

Regards,
Brian.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:itsmevic
ID: 38844805
Here's the portion of my code that specifies what color.  Where would I need to add the change at to make this work?

For Each matchResult In matches
                    ' highlight
                    If isHighlight Then
                        cell.Characters(matchResult.FirstIndex + 1, matchResult.Length).Font.Color = vbGreen
                        cell.Interior.Color = vbYellow
                    End If

Open in new window

0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 38844820
After line 5
cell.Font.FontStyle = "Bold"
0
 
LVL 13

Assisted Solution

by:Shanan212
Shanan212 earned 167 total points
ID: 38844837
Try this

For Each matchResult In matches
                    ' highlight
                    If isHighlight Then
                        activecell.Characters(matchResult.FirstIndex + 1, matchResult.Length).Font.Color = vbGreen
                        ActiveCell.Font.Bold = True
                    End If 

Open in new window

0
 
LVL 26

Accepted Solution

by:
redmondb earned 167 total points
ID: 38844981
itsmevic,

For Each matchResult In matches
                    ' highlight
                    If isHighlight Then
                        cell.Characters(matchResult.FirstIndex + 1, matchResult.Length).Font.Color = vbGreen
                        cell.Interior.Color = vbYellow
                        cell.Font.Bold = True
                    End If

Open in new window

Regards,
Brian.
0
 

Author Closing Comment

by:itsmevic
ID: 38852016
Awesome input from all.  Thank you!
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 38852042
You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2012
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38852151
Thanks, itsmevic!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question