+ Reply to Thread
Results 1 to 2 of 2

Change cell number format in VBA

  1. #1
    Registered User
    Join Date
    01-18-2010
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2007
    Posts
    16

    Change cell number format in VBA

    Is there a way I can format a cell using VBA code?

    I am using code to create a list of numbers. These numbers are dollar amounts so I would like to format them as currency ($X,XXX.XX). I then want to use the SUM worksheet function to sum the numbers so I cannot simply append a dollar sign to the front of the number. I also cannot format the cells on the worksheet ahead of time because the program uses the 'Clear' function to delete previous data before making a new list, but the 'Clear' function also seems to be clearing any formatting.

    So how can I format the values as currency as the VBA code writes them to their cells?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Change cell number format in VBA

    Try recording a macro.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1