Solved

Excel 2010:  .VBA Code for Bolding Text

Posted on 2013-02-01
10
259 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 45

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
 

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 45

Expert Comment

by:Martin Liss
ID: 38844820
After line 5
cell.Font.FontStyle = "Bold"
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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 45

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

PaperPort has a feature called the "Send To Bar". It provides a convenient, drag-and-drop interface for using other installed software, such as Microsoft Office. However, this article shows that the latest Office 2016 apps (installed with an Office …
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now