ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unable to set Bold property of the Font Class (https://www.excelbanter.com/excel-programming/277334-unable-set-bold-property-font-class.html)

Mike Lee

Unable to set Bold property of the Font Class
 
Hello,
I'm trying to run the following code, and I keep getting
the "Unable to set Bold property of the Font Class"
error. I tried using the FontBold property, but that
didn't do it either. When I add a watch to cl, I can see
the font.bold property in the watch window, but for
whatever reason, it won't let me write to it. I thought
it was a read/write property. Any thoughts?

code


For Each cl In rng
If cl.Value = "Total" Or cl.Value = "Average" Then
For i = 1 To 15
Select Case i
Case 1, 2, 6, 7, 11, 12
cl.Offset(0, i).NumberFormat = "#,##0.00"
cl.Offset(0, i).Font.Bold = True 'error here
Case Else
cl.Offset(0, i).Font.Bold = True 'error here
End Select
Next i
Else
End If
Next cl

more code


I've also tried cl.offset(0,i).characters.font.bold =
true with no luck.

If anyone has any ideas, I'd really appreciate them.

Thanks,
Mike


Tom Ogilvy

Unable to set Bold property of the Font Class
 
Try

ActiveCell.Activate
For Each cl In rng
If cl.Value = "Total" Or cl.Value = "Average" Then
For i = 1 To 15
Select Case i
Case 1, 2, 6, 7, 11, 12
cl.Offset(0, i).NumberFormat = "#,##0.00"
cl.Offset(0, i).Font.Bold = True 'error here
Case Else
cl.Offset(0, i).Font.Bold = True 'error here
End Select
Next i
Else
End If
Next cl

--
Regards,
Tom Ogilvy


"Mike Lee" wrote in message
...
Hello,
I'm trying to run the following code, and I keep getting
the "Unable to set Bold property of the Font Class"
error. I tried using the FontBold property, but that
didn't do it either. When I add a watch to cl, I can see
the font.bold property in the watch window, but for
whatever reason, it won't let me write to it. I thought
it was a read/write property. Any thoughts?

code


For Each cl In rng
If cl.Value = "Total" Or cl.Value = "Average" Then
For i = 1 To 15
Select Case i
Case 1, 2, 6, 7, 11, 12
cl.Offset(0, i).NumberFormat = "#,##0.00"
cl.Offset(0, i).Font.Bold = True 'error here
Case Else
cl.Offset(0, i).Font.Bold = True 'error here
End Select
Next i
Else
End If
Next cl

more code


I've also tried cl.offset(0,i).characters.font.bold =
true with no luck.

If anyone has any ideas, I'd really appreciate them.

Thanks,
Mike




vera[_3_]

Unable to set Bold property of the Font Class
 
Mike, were you able to resolve it? I am running into the same problem
and can't find a way to change font to bold on my cells. I can change
Font.Color property but changing Bold property raises the same error
you got :"Unable to set the Bold property of the Font class". I played
around with ActiveCell.Activate, it didn't help.

Your input would be highly appreciated. My direct email is
.

Thanks in advance,
Vera.


---
Message posted from
http://www.ExcelForum.com/



All times are GMT +1. The time now is 10:45 AM.

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