ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Bold some of the cell contents (https://www.excelbanter.com/excel-programming/328132-bold-some-cell-contents.html)

Brad

Bold some of the cell contents
 
Thanks for taking the time to read my question.

It is possible to apply the Bold font setting to an entire cell. It is also
possible to apply the Bold setting to portions of text in a cell and leave
the remaining portions unbolded (if that's a word...).

How can you do that in VBA?

Ex:

Activecell.value = "The Number Is 550055"

I want "550055" to be bold, and the rest not bold.

How do I do this in VBA?

Thanks,

Brad

Tom Ogilvy

Bold some of the cell contents
 
ActiveCell.Characters(15,6).Font.Bold = True

worked for me.

--
Regards,
Tom Ogilvy



"Brad" wrote in message
...
Thanks for taking the time to read my question.

It is possible to apply the Bold font setting to an entire cell. It is

also
possible to apply the Bold setting to portions of text in a cell and leave
the remaining portions unbolded (if that's a word...).

How can you do that in VBA?

Ex:

Activecell.value = "The Number Is 550055"

I want "550055" to be bold, and the rest not bold.

How do I do this in VBA?

Thanks,

Brad




JE McGimpsey

Bold some of the cell contents
 
one way:

Const sPREFIX = "The Number Is "
With ActiveCell
.Value = sPREFIX & 550055
.Characters(Len(sPREFIX) + 1).Font.Bold = True
End With




In article ,
"Brad" wrote:

Thanks for taking the time to read my question.

It is possible to apply the Bold font setting to an entire cell. It is also
possible to apply the Bold setting to portions of text in a cell and leave
the remaining portions unbolded (if that's a word...).

How can you do that in VBA?

Ex:

Activecell.value = "The Number Is 550055"

I want "550055" to be bold, and the rest not bold.

How do I do this in VBA?


Chip Pearson

Bold some of the cell contents
 
Try something like

Dim Pos As Integer
ActiveCell.Value = "The number is 123"
Pos = InStrRev(ActiveCell.Value, " ")
ActiveCell.Characters(Pos + 1, 999).Font.Bold = True



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Brad" wrote in message
...
Thanks for taking the time to read my question.

It is possible to apply the Bold font setting to an entire
cell. It is also
possible to apply the Bold setting to portions of text in a
cell and leave
the remaining portions unbolded (if that's a word...).

How can you do that in VBA?

Ex:

Activecell.value = "The Number Is 550055"

I want "550055" to be bold, and the rest not bold.

How do I do this in VBA?

Thanks,

Brad




Brad

Bold some of the cell contents
 
Perfect Tom!

Thanks,

Brad

"Tom Ogilvy" wrote:

ActiveCell.Characters(15,6).Font.Bold = True

worked for me.

--
Regards,
Tom Ogilvy



"Brad" wrote in message
...
Thanks for taking the time to read my question.

It is possible to apply the Bold font setting to an entire cell. It is

also
possible to apply the Bold setting to portions of text in a cell and leave
the remaining portions unbolded (if that's a word...).

How can you do that in VBA?

Ex:

Activecell.value = "The Number Is 550055"

I want "550055" to be bold, and the rest not bold.

How do I do this in VBA?

Thanks,

Brad






All times are GMT +1. The time now is 11:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com