+ Reply to Thread
Results 1 to 14 of 14

Problem with existing VBA to format currency

  1. #1
    Registered User
    Join Date
    03-24-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Problem with existing VBA to format currency

    Hi,

    I have written some code, that once a user selects a currency from the drop down, then all worksheets are scanned and all fields with a currency format are fomatted accordingly.
    So for example if a user selects United Kingdom, all cells with financial or currency information are formatted with the currency £.

    For some reason i had this code in another worksheet which was scanning multiple worksheets and worked perfectly. Now i only have one active worksheet and it nots working and i cant seem to pinpoint what the problem is,

    can anyone help?

    PS: i have uploaded the worksheet
    Attached Files Attached Files

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Problem with existing VBA to format currency

    Hi,

    Your sheet is called "Rough" not "Rough1" which is preventing the code from working. That would be readily apparent if you did not have On Error Resume Next simply ignoring all errors- not good practice.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    03-24-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Problem with existing VBA to format currency

    Thanks for the heads up but even after changing the reference to the Rough worksheet its still not working.

    When you select the currency and then press the set button, the currency is chaging in cells F7, but it is not adjusting the formatting of the E29, E31,E34.

    Basically these fields should be formatted according to cell F7, any ideas?
    Attached Files Attached Files

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Problem with existing VBA to format currency

    Apologies, my cursory look was at the wrong macro!

    You have this line in the convert currency macro

    Please Login or Register  to view this content.
    so only the Rough sheet is actually being processed.

  5. #5
    Registered User
    Join Date
    03-24-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Problem with existing VBA to format currency

    ok im guessing this is a dumb question, but how do i fix this?
    for this specific example i only want the input_values sheet to be checked and corrected.

    In the future i will have more worksheets so good to know how to do multiple worksheets in the future too.

    Can you be a bit more specific, as Macros are really not my thing

    thanks,

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Problem with existing VBA to format currency

    For this example then

    Please Login or Register  to view this content.
    That will skip any sheet that is not called "Input Values". You might also of course change the code to only look at that specific sheet but keeping the loop will make it simpler to adjust for more sheets in the future.
    Last edited by xlnitwit; 10-24-2016 at 07:48 AM.

  7. #7
    Registered User
    Join Date
    03-24-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Problem with existing VBA to format currency

    ok perfect this is working nicely, but its adding junk characters at the bottom,

    its putting in columsn F and G 44, junk characters like :
    ,0 F2
    P0 F2
    P0 F2
    P0 F2
    P0 F2
    F2 F2
    F1 F2


    any ideas why its doing this?

  8. #8
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Problem with existing VBA to format currency

    I'm not seeing any such characters. Which currency selections are you making?

  9. #9
    Registered User
    Join Date
    03-24-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Problem with existing VBA to format currency

    any selection i make, here attaching the file with the code you suggested. probably have put the code in wrong in the macro
    Attached Files Attached Files

  10. #10
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Problem with existing VBA to format currency

    I might suggest reducing your code to something a little more compact, thus
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    03-24-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Problem with existing VBA to format currency

    works like a charm thank you so much.

    Out of curiosity, if i had to add more worksheets to the file, what would i need to change???

    thanks,

  12. #12
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Problem with existing VBA to format currency

    If you want them to be included in the processing, you need only add them to this line
    Please Login or Register  to view this content.
    so that it would become
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    03-24-2016
    Location
    London
    MS-Off Ver
    2010
    Posts
    23

    Re: Problem with existing VBA to format currency

    thank you so much for the replies. have a nice day

  14. #14
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Problem with existing VBA to format currency

    You're most welcome.

+ 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: 8
    Last Post: 03-08-2012, 02:17 PM
  2. Problem is cant format a cell to currency.
    By joey29842 in forum Excel General
    Replies: 0
    Last Post: 10-31-2011, 09:38 PM
  3. problem with simple code to change currency format...
    By sunilmulay in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-07-2009, 11:12 AM
  4. Replies: 4
    Last Post: 11-14-2008, 11:21 AM
  5. vlooup-Can't find existing value - NOT format problem
    By EliJB in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-24-2008, 04:55 PM
  6. Simple Currency format problem
    By mickscool in forum Excel General
    Replies: 1
    Last Post: 11-13-2005, 10:10 PM
  7. [SOLVED] Change General Format to Currency Format:figures together
    By ScottO in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-06-2005, 04:05 AM

Tags for this Thread

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