Mackeral
Board Regular
- Joined
- Mar 7, 2015
- Messages
- 232
- Office Version
- 365
- Platform
- Windows
Here is the code
When it gets called inside a Program, it doesn't change the indicated cells from Bold to non_Bold.
If I stop the code on the call and then execute it, it does.
Can anyone tell me what's gong on?
Thanks, Mac
VBA Code:
Function Cell_Font(Sheet_Spec, ByVal Rng_Arg, _
Optional Bold_Test As Boolean = False, _
Optional Italic_Test As Boolean = False, _
Optional Font_Size As Integer = 0, _
Optional Font_Name = "", _
Optional Underline_Style As XlUnderlineStyle = xlUnderlineStyleNone)
' 10/6/15 Put in All_Rng_Arg call. WML
' 9/2/19 Added ""Name" to argument list. WML
' 6/1/20 Changed name from "Cell_Font" and changed args around. WML
' 8/31/20 WML Reworked. WML
' Note: If the Font Name is illegal, Excel will revert to using the current font.
Dim SHEET As Worksheet
Prog = "Cell_Font"
Call Wait(0, 0, 0.5)
Call Sheet_Arg(Sheet_Spec, SHEET, Sheet_Name)
If InStr(Rng_Arg, ":") = 0 Then Rng_Arg = Rng_Arg & ":" & Rng_Arg
With SHEET
Range(Rng_Arg).Select
Selection.Font.Bold = Bold_Test ' <-- Bold_Test is set to False and the cell to be operated on is showing in Bold.
Selection.Font.Italic = Italic_Test
If Len(Font_Name) Then Selection.Font.Name = Font_Name
If FontSize > 0 Then Selection.Font_Size = Font_Size
Selection.Font.Underline = Underline_Style
End With
End Function ' Cell_Font()
When it gets called inside a Program, it doesn't change the indicated cells from Bold to non_Bold.
If I stop the code on the call and then execute it, it does.
Can anyone tell me what's gong on?
Thanks, Mac