+ Reply to Thread
Results 1 to 3 of 3

Code needed to replace all Custom formatted cells with currency formatted cells

  1. #1
    Forum Contributor
    Join Date
    11-15-2008
    Location
    Arizona
    MS-Off Ver
    Excel 2013
    Posts
    179

    Code needed to replace all Custom formatted cells with currency formatted cells

    I have designed a spreadsheet that people in other countries will be using. All the currency cells are formatted as currency, so for me the $ symbol shows. When I go into my control panel and change the default currency to Euros or something, then all the cells formatted as currency change to the Euro symbol, which is perfect. However, when I close out of the workbook and then reopen it, it no longer shows the Euro symbol. It shows the American dollar because all of the cells formatted as currency got switched to custom ("$"#,##0.00), so it doesn't read the computer's default currency setting and instead forces the $ symbol since it is a custom setting.

    When I change my control panel back to the American dollar, the cells are once more formatted as currency, not that custom setting.

    I had a gal in another country test it, and same thing. She can't get the pound symbol at all. Since her computer settings are already configured to the pound symbol, when she opens the workbook for the first time, all of the currency cells are custom cells forcing the $.

    This is a problem since my workbook will be used from people in a variety of countries. (No need to do any conversions as the user will be entering in the amount. I just need the symbol to change).

    I went in and did a find and replace.
    Find all cells formatted with "$"#,##0.00; [Red]"$"#,##,0.00 and replace with Currency formatting
    Find all cells formatted with "$"#,##0.00 and replace with Currency formatting.

    This then changed all the custom cells back to currency cells, and it would read the computer's currency setting ( I had my set at Euros to test). Then I saved and closed and upon reopen it was still there. Perfect.

    So now I just need a code that when a user opens the workbook for the first time, they can click on change currency to mine, and it will automatically run this find and replace for them.

    I attempted to create the macro by simply recording my find and replace steps. However, it won't execute the recorded VBA. It just gives an object-defined error.

    Please Login or Register  to view this content.
    Can anyone think of a code that would find all custom cells and replace them with currency?
    Last edited by dsrt16; 09-27-2018 at 02:15 AM.

  2. #2
    Forum Contributor
    Join Date
    11-15-2008
    Location
    Arizona
    MS-Off Ver
    Excel 2013
    Posts
    179

    Re: Code needed to replace all Custom formatted cells with currency formatted cells

    I found a code I thought would work, but it is not. Could you please help?

    Right now, the cells I formatted as currency were reformatted upon opening to this custom string "$"#,##0.00_);[Red]("$"#,##0.00) since I changed my default currency to Euros.

    So I tried to run a loop where it looked for cells with that format and changed it to a currency format. But it says type mismatch and highlights the if c.numberformat line. But I know I have cells formatted as that custom string. So what's with the type mismatch? Did I enter that custom string in incorrectly for vba format?

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    11-15-2008
    Location
    Arizona
    MS-Off Ver
    Excel 2013
    Posts
    179

    Re: Code needed to replace all Custom formatted cells with currency formatted cells

    I solved it.

    Instead of looking for custom formatted cells and changing it to currency, I just put in all the cells that need currency and set them to currency in VBA.

    So users in a different country will need to click on the "Update symbol" button, and it will run the VBA code that will change all the "custom" cells to currency cells.

    I just did this line of code for every single range that needs the currency symbol:

    Please Login or Register  to view this content.
    It works great. Now hopefully it works when someone out of country tests it. :D

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 09-26-2018, 03:19 PM
  2. Formula to show percentage of cells in each segment in custom formatted cells
    By newbie_Lau in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-03-2016, 01:21 PM
  3. [SOLVED] Count Custom Number Formatted Cells
    By SamCV in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-16-2015, 10:28 AM
  4. Find/Replace conditional formatted cells
    By matg in forum Excel General
    Replies: 2
    Last Post: 12-06-2012, 04:39 AM
  5. Replies: 2
    Last Post: 09-23-2009, 03:03 PM
  6. Replies: 4
    Last Post: 07-07-2006, 04:20 AM
  7. Converting 'General' formatted cells to Text formatted cell using.
    By Zahid Khan in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-12-2005, 04:06 PM

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