Consulting

Results 1 to 3 of 3

Thread: Solved: Need help to change column to comma style

  1. #1
    VBAX Regular
    Joined
    Sep 2011
    Posts
    42
    Location

    Solved: Need help to change column to comma style

    Hi,

    Sorry to bother everyone, but I'm having a problem with the excel file attached. If you look in column C, you'll notice they contain numbers, however they are showing up as text (they will not sum and if you highlight some of the numbers, excel shows the count property).

    The only way I can get around it is to highlight the column, click the currency button, and for each cell press "F2 + enter". Then it changes it to an accounting format.

    I tried:

    With activecell
    .clearformats
    .style = "comma"
    .select
    .activate
    end with

    but none of that seems to work. The file is being pulled from an ad hoc report if that might be the cause.

    I'm trying to figure it out as you can imagine it gets tedious if I had hundreds of them to go through.

    Thank you for your help in advance.
    Attached Files Attached Files

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Columns("C").TextToColumns Destination:=Range("C1"), DataType:=xlDelimited, _
    TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
    Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
    :=Array(1, 1), TrailingMinusNumbers:=True
    Range("C1").Value = ""
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Sep 2011
    Posts
    42
    Location
    Thanks xld, I really appreciate your help.

Posting Permissions

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