ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection.Font.Bold = True (https://www.excelbanter.com/excel-programming/419245-selection-font-bold-%3D-true.html)

Steved

Selection.Font.Bold = True
 
Hello from Steved

The below works fine but I would like to bold the,

"REDUCED PEAK 2008 - 2009" please,

I've not sure where to insert Selection.Font.Bold = True

as it is not working, What do I need to do please to have this working, I
thankyou.

Sub REDUCEDPEAK()
Cells.Replace What:="Auckland", Replacement:="REDUCED PEAK 2008 - 2009", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:= _
False, ReplaceFormat:=False
Selection.Font.Bold = True
Selection.Copy
Application.CutCopyMode = False
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWorkbook.Close SaveChanges:=False
ActiveCell.Offset(2, 0).Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True

End Sub


Bernard Liengme

Selection.Font.Bold = True
 
Do this:
Turn on Macro Record
In some cell type: Mary had a little lamb. It fleece was white
Select "little lamb" and make bold
Turn off Recorder
Look at the subroutine in VBA
It will have something like

With ActiveCell.Characters(Start:=6, Length:=12).Font
.Name = "Calibri"
.FontStyle = "Bold"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Steved" wrote in message
...
Hello from Steved

The below works fine but I would like to bold the,

"REDUCED PEAK 2008 - 2009" please,

I've not sure where to insert Selection.Font.Bold = True

as it is not working, What do I need to do please to have this working, I
thankyou.

Sub REDUCEDPEAK()
Cells.Replace What:="Auckland", Replacement:="REDUCED PEAK 2008 -
2009", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:= _
False, ReplaceFormat:=False
Selection.Font.Bold = True
Selection.Copy
Application.CutCopyMode = False
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWorkbook.Close SaveChanges:=False
ActiveCell.Offset(2, 0).Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True

End Sub




Steved

Selection.Font.Bold = True
 
Hello Bernard from Steved

I thankyou

Below is what I achieved.


Sub REDUCEDPEAK()
Cells.Replace What:="Auckland", Replacement:="REDUCED PEAK 2008 - 2009", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:= _
False, ReplaceFormat:=False
Cells.Find(What:="REDUCED PEAK 2008 - 2009", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Selection.Font.Bold = True
Application.CutCopyMode = False
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWorkbook.Close SaveChanges:=False
ActiveCell.Offset(2, 0).Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True

End Sub




"Bernard Liengme" wrote:

Do this:
Turn on Macro Record
In some cell type: Mary had a little lamb. It fleece was white
Select "little lamb" and make bold
Turn off Recorder
Look at the subroutine in VBA
It will have something like

With ActiveCell.Characters(Start:=6, Length:=12).Font
.Name = "Calibri"
.FontStyle = "Bold"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With

best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"Steved" wrote in message
...
Hello from Steved

The below works fine but I would like to bold the,

"REDUCED PEAK 2008 - 2009" please,

I've not sure where to insert Selection.Font.Bold = True

as it is not working, What do I need to do please to have this working, I
thankyou.

Sub REDUCEDPEAK()
Cells.Replace What:="Auckland", Replacement:="REDUCED PEAK 2008 -
2009", _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:= _
False, ReplaceFormat:=False
Selection.Font.Bold = True
Selection.Copy
Application.CutCopyMode = False
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
ActiveWorkbook.Close SaveChanges:=False
ActiveCell.Offset(2, 0).Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True

End Sub






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

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