• formatting for percentage (2000/2003)

    Author
    Topic
    #423292

    I am trying a VB in excel to format a cell into percentage, but for some reason it is not formatting it. Any ideas would help. Here is the code I wrote. Thanks.
    worksheets(“allotment”).Range(“f27”).Select
    With Selection.Style = “percent”
    End With

    Viewing 0 reply threads
    Author
    Replies
    • #968137

      Perhaps the cell contains text – sometimes the contents look like a number, but Excel interprets it as text. Try this:

      With Worksheets("Allotment").Range("F27")
      .Style = "Percent"
      .Value = .Value
      End With

      Note that the cell is not selected. Often, you don’t need to select cells in a macro.

    Viewing 0 reply threads
    Reply To: formatting for percentage (2000/2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: