PDA

View Full Version : can't get rid of Bold



SMC
01-08-2007, 05:50 PM
A strange problem with a cell formatting.

I have some dynamic (vba) formating on my Sheet, means that an old format can be left although the cell is empty.
Because of that i've made a code which should take along the format of certain value.
But it doesn't work well:
.
.
.
If (Size.Text = dx.SizeX(k)) Then
ActiveSheet.Cells(6 + stepX + i, k + 2).Select
ActiveCell.Font.Bold = False
ActiveCell.Font.Italic = False
ActiveCell.Font.Name = "Arial"
ActiveCell.Font.Size = 10
ActiveCell.Value = Amount.Text when this code encounters a cell which was previously formated as bold i get the value bolded, what i don't want.:bug:


Thanks

XLGibbs
01-08-2007, 06:15 PM
ActiveCell.ClearFormats
Put that in there first

You can also tidy it up

If (Size.Text = dx.SizeX(k)) Then
Dim c as Range
Set c = ActiveSheet.Cells(6 + stepX + i, k + 2)
WIth c
.ClearFormats
With .Font
.Bold = False
.Italic = False
.Name = "Arial"
.Font.Size = 10
End with
.Value = Amount.Text
End With

SMC
01-08-2007, 06:47 PM
Thanks a lot for the tips.:thumb

(i found a mistake in the other part of the code which was cause of this issue :banghead:)