+ Reply to Thread
Results 1 to 8 of 8

Macro that changes # format doesn't work. Press "run," dialog box disappears, no error msg

  1. #1
    Registered User
    Join Date
    12-04-2013
    Location
    North Texas
    MS-Off Ver
    Excel 2010
    Posts
    4

    Talking Macro that changes # format doesn't work. Press "run," dialog box disappears, no error msg

    Hello,
    I purchased a book and tried to follow the step-by-step instructions on how to run a macro. When I select the cell, select the Macro, and press "Run," the dialog box disappears, but the Macro does not run and there is no error message. I checked the code and compared it to what is given in the book and the two are the same.
    Please Login or Register  to view this content.
    Things I have tried: made sure I selected the right workbook that contains my macro; enabled macros under "Macro Secutiry."
    I am using Excel 2010.
    Thank you for your help!
    Last edited by OldManLearningExcel; 12-04-2013 at 11:09 PM.

  2. #2
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: Trying to run a simple macro, but nothing happens when I run it.

    Are you trying to get it to change the whole number or just the display of it?

    I ran the code using pi as my decimal and it sets the format of the cell to $3 but doesn't change the actual data contained in the cell.

    Could you provide more background information on the values in the cell(s) that you are running this on?
    Janos S. Vamos
    Data Systems Technician/Fire Controlman PO1(SW/AW)
    US Navy Retired


    Remember, Record Macro can be your friend for figuring out solutions.

    Good or Bad, let me know how I did by clicking on the "Add Reputation" * just to the lower left of here. it only takes a few seconds to let someone know.

  3. #3
    Registered User
    Join Date
    12-04-2013
    Location
    North Texas
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Trying to run a simple macro, but nothing happens when I run it.

    Thank you for your prompt response, VamosJ,

    I am just trying to change the display of the number.

    The numbers were manually entered in the cells under the general format. I wanted to change the format of the number from the general format to the accounting format with zero decimal points with a "$" symbol.

    [Aside: I know that I can change it by selecting the cells and formatting them, but I am trying to learn the basics of macros.]

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Trying to run a simple macro, but nothing happens when I run it.

    hmm i inserted that code in my system and it runs and works as intended?
    are you sure it did not run?

    select the single line of code and press F9 to toggle breakpoint and then run the code
    does the code highlight yellow?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,917

    Re: Trying to run a simple macro, but nothing happens when I run it.

    Hi oldman and welcome to the forum

    Thanks for the title change
    Last edited by FDibbins; 12-04-2013 at 11:33 PM.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  6. #6
    Registered User
    Join Date
    12-04-2013
    Location
    North Texas
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Trying to run a simple macro, but nothing happens when I run it.

    Hi humdingaling and thank you for your help,
    When I select the line of code
    Please Login or Register  to view this content.
    and press F9, the code is highlighted in maroon. When I run the code, the line highlights yellow.

    Based on your and vamosj's responses, I believe the code is correct. I selected the cells I wished to run the macro on, clicked Macros, selected the macro name, selected "This Workbook," and pressed run. The dialog box disappears, but the number remains in the "general" format instead of the accounting format with a dollar sign. Maybe I'm running it incorrectly? Sorry for this novice question, hard to teach an old dog new tricks!
    Thanks again!

  7. #7
    Registered User
    Join Date
    12-04-2013
    Location
    North Texas
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Trying to run a simple macro, but nothing happens when I run it.

    Hi humdingaling and thank you for your help,
    When I select the line of code
    Please Login or Register  to view this content.
    and press F9, the code is highlighted in maroon. When I run the code, the line highlights yellow.

    Based on your and vamosj's responses, I believe the code is correct. I selected the cells I wished to run the macro on, clicked Macros, selected the macro name, selected "This Workbook," and pressed run. The dialog box disappears, but the number remains in the "general" format instead of the accounting format with a dollar sign. Maybe I'm running it incorrectly? Sorry for this novice question, hard to teach an old dog new tricks!
    Thanks again!

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Macro that changes # format doesn't work. Press "run," dialog box disappears, no error

    hmm

    the code only works on things you have selected
    so before you run the code do you have the cell(s) you want changed selected/highlighted?

    ps location of macro would not change output in this case

    cant find any fault in the code itself

    do you mind saving copy and uploading
    i wouldnt mind running your file on my system to see if it does anything
    Last edited by humdingaling; 12-04-2013 at 11:53 PM.

+ 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. [SOLVED] Excel 2010 VB macro to open all files in folder and run a simple macro
    By MSFLNA in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2013, 02:54 PM
  2. My macro needs a couple tweeks- Fairly simple copy and paste macro
    By wiebs2334 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2013, 08:02 AM
  3. My macro needs a couple tweeks- Fairly simple copy and paste macro
    By wiebs2334 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2013, 08:23 PM
  4. [SOLVED] Date Macro - Code Breaks - (Simple Macro)
    By aiwnjoo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-12-2010, 05:36 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