Consulting

Results 1 to 3 of 3

Thread: can't get rid of Bold

  1. #1

    can't get rid of Bold

    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:
    [vba].
    .
    .
    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[/vba] when this code encounters a cell which was previously formated as bold i get the value bolded, what i don't want.


    Thanks

  2. #2
    VBAX Master XLGibbs's Avatar
    Joined
    Jan 2006
    Location
    state of confusion, but vacation in denial
    Posts
    1,315
    Location
    [vba] ActiveCell.ClearFormats[/vba]
    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
    If you have posted the same question at multiple forums, please read this IMPORTANT INFO.

    Please use the thread tools to mark your thread Solved


    Please review the Knowledge Base
    for samples and solutions , or to submit your own!




  3. #3
    Thanks a lot for the tips.

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •