Solved

Excel 2010:  .VBA Code for Bolding Text

Posted on 2013-02-01
10
265 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 48

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 48

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 48

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

717 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