I have a button on a form that exports a datasheet form to an excel spreadsheet.
I have coded a VB function to do some formatting of the exported spreadsheet.
All of it has worked up to this point. One of the things it does is subtotal the worksheet. I have just received a request to Bold the subtotal amounts (Excel only bolds the subtotal text).
I added the following code to my function which, when run, produces a runtime error '1004': Unable to set the Bold property of the Font class.
I have two other conditional formats that occur prior to this one; they set text to red if negative...these work fine.
'Format Subtotals as Bold
.Columns("A:N").Select
.Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($B1,5)=""Total"""
.Selection.FormatConditions(.Selection.FormatConditions.Count).SetFirstPriority
With .Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.TintAndShade = 0
End With
.Selection.FormatConditions(1).StopIfTrue = False
I have coded a VB function to do some formatting of the exported spreadsheet.
All of it has worked up to this point. One of the things it does is subtotal the worksheet. I have just received a request to Bold the subtotal amounts (Excel only bolds the subtotal text).
I added the following code to my function which, when run, produces a runtime error '1004': Unable to set the Bold property of the Font class.
I have two other conditional formats that occur prior to this one; they set text to red if negative...these work fine.
'Format Subtotals as Bold
.Columns("A:N").Select
.Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=RIGHT($B1,5)=""Total"""
.Selection.FormatConditions(.Selection.FormatConditions.Count).SetFirstPriority
With .Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.TintAndShade = 0
End With
.Selection.FormatConditions(1).StopIfTrue = False