+ Reply to Thread
Results 1 to 18 of 18

What determines location of VBA code from recorded macro?

  1. #1
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    What determines location of VBA code from recorded macro?

    I recorded a macro (as a basis for editing, maybe with help here). But how are you supposed to know where to find the VBA code please?

    I assumed it would be in PERSONAL.xlsb as a new module, But as you see it's replaced whatever was in Module 8, rather than creating Module 16.

    Excel-VBA-Module-Location.jpg


    What logic or inadvertent setting on my part gets it into Module 8?

    Also, could I ask a couple of associated very basic queries please:

    1. Is there any way to change 'Module 1' etc to meaningful names?
    2. Or search for a macro name?
    3. Is there a KB shortcut to stop a macro recording, rather than the four clicks, in my case: Classical Menu > Tools > Macro > Stop Recording

    4. With many modules open, as I had here, can I close them all at once instead of individually?

    --
    Terry, East Grinstead, UK
    Last edited by terrypin; 02-25-2017 at 06:34 AM.
    Terry, East Grinstead, UK
    Excel 365, Win 10 Pro, i7 PC, 4.0 GHz

  2. #2
    Forum Contributor
    Join Date
    08-04-2004
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    186

    Re: What determines location of VBA code from recorded macro?

    It does not replace an existing module so module 8 must have been removed at some point

    1. Yes you can change module name. Make sure the properties window is visible. Click next to name in properties window to edit name. Be aware a module can contain more than 1 macro
    2. In vba just click tools:macros and the macro dialogue window opens
    3. There should be a"stop recording" button. What version of excel do yiu use?
    Attached Images Attached Images
    Last edited by philaugust2004; 02-25-2017 at 07:28 AM.

  3. #3
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: What determines location of VBA code from recorded macro?

    Quote Originally Posted by terrypin View Post
    2. Or search for a macro name?
    Save the workbook attached in your Xlstart folder (the same one your personal workbook is in.) as a xlsb file.
    In your project list you will now have a project called "Select Personal Macros (User Form).xlsb".
    Under tools - References make sure that "mMcrosoft visual basic for applications extensibility 5.3" is checked.
    Under Modules in Select Personal Macros (User Form).xlsb run the ShowMacroUserForm macro.

    You will then get a userform to see all the macro's in your personal workbook and you can run the macro's from there.

    Btw, I didn't create the file so apologies to the person who did because I can't remember who it was now to give them credit
    Attached Files Attached Files
    If my solution worked (or not) please let me know. If your question is answered then please remember to mark it solved

    Computers are like air conditioners. They work fine until you start opening windows. ~Author Unknown

  4. #4
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: What determines location of VBA code from recorded macro?

    Please provide links when cross-posting as per the forum rules...

    https://www.mrexcel.com/forum/excel-...ml#post4765353

  5. #5
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: What determines location of VBA code from recorded macro?

    Thanks Phil, appreciate the fast reply.

    That would explain the module 8 choice.

    #1. Thanks, I've duly renamed one module and will do the others later. BTW, I'm surprised that the familiar Right-click doesn't include Rename in its context menu?

    #2. OK, that gives a handy list by workbook, similar to the one from Alt+F8 in the main Excel app. (It's easier to read as it doesn't prefix the entry with the workbook name). So I assume there's no Search tool?

    #3. I'm using Excel 365 and found the large Ribbon rather daunting following my move from Excel 2000 after many years. But I see that for VBA/macros it would be better to use the Developer tab, where I do see a Macro Record button, thanks.

    P.S. When typing replies in this forum, is it possible to get word-wrap? At present, all I can see in the line above is '...better to'

    --
    Terry, East Grinstead, UK

  6. #6
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: What determines location of VBA code from recorded macro?

    Quote Originally Posted by terrypin View Post

    #3. I'm using Excel 365 and found the large Ribbon rather daunting following my move from Excel 2000 after many years. But I see that for VBA/macros it would be better to use the Developer tab, where I do see a Macro Record button, thanks.
    In your status bar next to where it says "Ready" do you not have a Record button (I don't use 365 so can't see if it is diferent)?

  7. #7
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: What determines location of VBA code from recorded macro?

    Quote Originally Posted by WasWodge View Post
    Save the workbook attached in your Xlstart folder (the same one your personal workbook is in.) as a xlsb file.
    In your project list you will now have a project called "Select Personal Macros (User Form).xlsb".
    Under tools - References make sure that "mMcrosoft visual basic for applications extensibility 5.3" is checked.
    Under Modules in Select Personal Macros (User Form).xlsb run the ShowMacroUserForm macro.

    You will then get a userform to see all the macro's in your personal workbook and you can run the macro's from there.

    Btw, I didn't create the file so apologies to the person who did because I can't remember who it was now to give them credit
    Thanks. Looks a bit heavy but I'll set aside some time to try it. Although I'm fairly happy running them from Alt+F8. It's finding them in what are currently numbered 'Modules' that's tedious!
    Any way to close all modules at once?

    --
    Terry, East Grinstead, UK

  8. #8
    Forum Contributor
    Join Date
    08-04-2004
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    186

    Re: What determines location of VBA code from recorded macro?

    Do you have a "record macro" button in Developer tab?

  9. #9
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: What determines location of VBA code from recorded macro?

    Quote Originally Posted by terrypin View Post
    Any way to close all modules at once?
    Only way I know of is with MZ-Tools and I as you use 365 it probably isn't an option.

  10. #10
    Forum Contributor
    Join Date
    08-04-2004
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    186

    Re: What determines location of VBA code from recorded macro?

    Quote Originally Posted by terrypin View Post
    Thanks Phil, appreciate the fast reply.

    That would explain the module 8 choice.

    #1. Thanks, I've duly renamed one module and will do the others later. BTW, I'm surprised that the familiar Right-click doesn't include Rename in its context menu?

    #2. OK, that gives a handy list by workbook, similar to the one from Alt+F8 in the main Excel app. (It's easier to read as it doesn't prefix the entry with the workbook name). So I assume there's no Search tool?

    #3. I'm using Excel 365 and found the large Ribbon rather daunting following my move from Excel 2000 after many years. But I see that for VBA/macros it would be better to use the Developer tab, where I do see a Macro Record button, thanks.

    P.S. When typing replies in this forum, is it possible to get word-wrap? At present, all I can see in the line above is '...better to'

    --
    Terry, East Grinstead, UK
    1. Probably so modules don't get renamed accidentally
    2. No search as far as I know
    3 Your stop recording button is hidden. To get it back, start recording a macro and then click View tab:macros:stop recording. This should bring the button back

  11. #11
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: What determines location of VBA code from recorded macro?

    Quote Originally Posted by philaugust2004 View Post
    3 Your stop recording button is hidden. To get it back, start recording a macro and then click View tab:macros:stop recording. This should bring the button back
    You've rather lost me on that, Phil. Do you mean under Classic Menu? I have no Start or Stop Macro Recording button there. And starting and stopping a macro doesn't create one.

    Excel365-ClassicMenu-Ribbon-2.jpg

    If you mean under the Developer menu. as mentioned I do have a button there. And other useful tools. So an extra click to open up Developer is no big deal, although ideally I'd like a button under Classic menu too.

    Excel365-DeveloperMenu-Ribbon-1.jpg

    --
    Terry, East Grinstead, UK
    Last edited by terrypin; 02-25-2017 at 10:32 AM.

  12. #12
    Forum Contributor
    Join Date
    08-04-2004
    Location
    Amsterdam
    MS-Off Ver
    2016
    Posts
    186

    Re: What determines location of VBA code from recorded macro?

    I have excel 2010 so don't know about earlier versions
    Attached Images Attached Images

  13. #13
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: What determines location of VBA code from recorded macro?

    Quote Originally Posted by philaugust2004 View Post
    I have excel 2010 so don't know about earlier versions
    the OP is using 365 which is the latest version (although the OP does have an aversion to using the ribbon).
    Last edited by WasWodge; 02-25-2017 at 11:11 AM.

  14. #14
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: What determines location of VBA code from recorded macro?

    Hi terrypin,

    There may be a 'Start Macro Recording' ('Stop Macro Recording) icon at the left edge of the 'Status Bar' (bottom of the screen) on your 'Office 365 Excel'.

    Lewis

  15. #15
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: What determines location of VBA code from recorded macro?

    Bingo, thanks Lewis, never would have thought of looking for it there!

    --
    Terry, East Grinstead, UK

  16. #16
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: What determines location of VBA code from recorded macro?

    Quote Originally Posted by terrypin View Post
    Bingo, thanks Lewis, never would have thought of looking for it there!

    --
    Terry, East Grinstead, UK
    See post #6

  17. #17
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: What determines location of VBA code from recorded macro?

    Quote Originally Posted by philaugust2004 View Post
    Do you have a "record macro" button in Developer tab?
    Yes, as I reported in post #5.

    --
    Terry, East Grinstead, UK

  18. #18
    Forum Contributor terrypin's Avatar
    Join Date
    01-06-2010
    Location
    East Grinstead, UK
    MS-Off Ver
    MS Office 365
    Posts
    533

    Re: What determines location of VBA code from recorded macro?

    Quote Originally Posted by WasWodge View Post
    See post #6
    Duh, misread that, sorry. You get the seegar!


    --
    Terry, East Grinstead, UK
    Last edited by terrypin; 02-25-2017 at 02:02 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. Use code instead of recorded macro
    By harman83 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-11-2015, 10:17 AM
  2. [SOLVED] Where can I find code for recorded macro
    By ammartino44 in forum Excel General
    Replies: 3
    Last Post: 02-25-2015, 03:12 PM
  3. Condensing code from a recorded macro
    By MissaLissa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2014, 10:39 AM
  4. Replace Macro recorded code with more effective code
    By scaffdog845 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-12-2014, 01:09 AM
  5. clean code from recorded macro
    By tim5 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-07-2012, 12:45 PM
  6. Mod macro recorded code
    By usr789 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2007, 09:27 AM
  7. [SOLVED] Call recorded macro from VBA code
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2005, 05:05 PM

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