Solved

Excel 2010:  .VBA Code for Bolding Text

Posted on 2013-02-01
10
262 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

786 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