Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Aug 2005
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    formatting for percentage (2000/2003)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: formatting for percentage (2000/2003)

    Perhaps the cell contains text - sometimes the contents look like a number, but Excel interprets it as text. Try this:
    <code>
    With Worksheets("Allotment").Range("F27")
    .Style = "Percent"
    .Value = .Value
    End With
    </code>
    Note that the cell is not selected. Often, you don't need to select cells in a macro.

  3. #3
    Lounger
    Join Date
    Aug 2005
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: formatting for percentage (2000/2003)

    Thanks Hans.

Posting Permissions

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