+ Reply to Thread
Results 1 to 18 of 18

Keeping ALL macros in Personal.xlsb ?

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

    Keeping ALL macros in Personal.xlsb ?

    I've used VBA for years but mainly in a sort of Copy/Paste/Adapt mode. As a novice one of my main difficulties I still have is deciding where to place a code module so that it's accessible when I decide to run it.

    I'm considering simplifying matters by placing ALL of them in PERSONAL.XLSB? Is that OK?
    Terry, East Grinstead, UK
    Excel 365, Win 10 Pro, i7 PC, 4.0 GHz

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Keeping ALL macros in Personal.xlsb ?

    Unless it's workbook specific, there is no reason you can't do that.
    Remember what the dormouse said
    Feed your head

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

    Re: Keeping ALL macros in Personal.xlsb ?

    Thanks Rory, appreciate the fast reply. That will make things a lot easier.

    Even if I have some macros that will only ever be required in specific workbooks, presumably they don't have to be stored there?

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Keeping ALL macros in Personal.xlsb ?

    No, they don't have to be, it just makes more sense.

  5. #5
    Registered User
    Join Date
    07-17-2019
    Location
    Amherst, NY
    MS-Off Ver
    2016
    Posts
    5

    Re: Keeping ALL macros in Personal.xlsb ?

    Just to follow up, I've been thinking about doing this for a while, but the thought of opening hundreds of workbooks, copying the macros to a Personal.xlsb and then sorting through and deleting duplicates is a daunting task. Has anyone ever automated this process?

  6. #6
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    456

    Re: Keeping ALL macros in Personal.xlsb ?

    I would suggest building a workbook with all your code like PERSONAL.XLSB but make it xlam and make it a addin that way you dont have 2 instances of excel open all the time, anyway it works better for me
    it gets loaded every time you open excel
    unless you have worksheets in your PERSONAL.XLSB then you should keep it the way it is an addin its sheets are not visible in excel
    Please be as complete as possible in your asking so it may save use all the time to rework the solution because you didn't give all the requirements. If you have a layout in mind please work it out first so we can adapt our solution to it. Thanks.
    If you have been helped, maybe you could click the *

  7. #7
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    456

    Re: Keeping ALL macros in Personal.xlsb ?

    @DIHayman

    collecting code shouldn't be to hard to make, but looking for duplicates will be hard i think

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

    Re: Keeping ALL macros in Personal.xlsb ?

    Thanks for the follow-up Rory, but I've just thought of a potential problem. Presumably all simple cell references like B12, which were OK for a macro in the same workbook it was intended to be run, would have to be expanded to explicitly show the workbook and worksheet?

    If so, is there an intuitive edit that will always work, such as changing it to something like WorkbookName.Worksheet.B12?

    Maybe I'll post separately about this more general question.

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

    Re: Keeping ALL macros in Personal.xlsb ?

    @Joske920

    That sounds an interesting alternative. Do you mean I just create an empty workbook, called say Mymacros.xlam, paste all my code into its VBA window, and place that file in \XLSSTART?

  10. #10
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Keeping ALL macros in Personal.xlsb ?

    In a normal module, any unqualified range reference - e.g. just Range("A1") - will refer to A1 on the active sheet of the active workbook. That is the same no matter which workbook the code is in, so I'm not sure I really see it as an issue. I cannot see any benefit to moving code that should apply to a specific sheet in a specific workbook into another workbook.

  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: Keeping ALL macros in Personal.xlsb ?

    @DIHayman: I hope there is indeed some existing macro or tool. Otherwise I'm considering using my Macro Express Pro to do the task. (Unfortunately it uses proprietary script that cannot be shared with non-users.)

    @Joske920: I would expect that would be reasonably easy to do visually after a sort.

  12. #12
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    456

    Re: Keeping ALL macros in Personal.xlsb ?

    When you save a xlam addin it will save to a specific location in %APPDATA% folders not in \XLSSTART

    I made a normal excel workbook with .xlsm ands put all the code in there, i didnt use the sheets in the workbook only modules because a xlam file is not visible in excel only in the VBA editor
    I saved that .xlsm file to xlam so i always have a workbook to edit if necessary

    just try something and you will see what the benefits are compared to a normal workbook

  13. #13
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Keeping ALL macros in Personal.xlsb ?

    Worth noting that macros in an add-in do not appear in the macros list, so you need to build a menu system for them.

  14. #14
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    456

    Re: Keeping ALL macros in Personal.xlsb ?

    If you trust the xlam file in FILE -> OPTIONS -> ADD-INS -> Manage-GO -> select your addin

    all code will be in the VBA editor

  15. #15
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: Keeping ALL macros in Personal.xlsb ?

    You could export all your modules from your sheets - maybe using something like this from Ron de Bruin

    https://www.rondebruin.nl/win/s9/win002.htm

    Then you can try this tool for managing a vba library.
    Import them all into this and see if it helps manage where there are duplicates and delete them as needed.

    http://www.vbaexpress.com/kb/getarticle.php?kb_id=1054
    Last edited by scottiex; 01-01-2020 at 01:39 PM.
    If you want something done right... find a forum and ask an online expert.

    Time flies like an arrow. Fruit flies like a banana.

  16. #16
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,256

    Re: Keeping ALL macros in Personal.xlsb ?

    Quote Originally Posted by Joske920 View Post
    If you trust the xlam file in FILE -> OPTIONS -> ADD-INS -> Manage-GO -> select your addin

    all code will be in the VBA editor
    Most people want macros available through the UI for ease of use I would think.

  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: Keeping ALL macros in Personal.xlsb ?

    @Joske920, @scottiex: Thanks both. I'll explore those suggestions at a later date but meanwhile I've changed my approach, at least for my current project.

    One workbook, WalkIndex.xlsm, will always be open. So I'm going to keep all macros that operate on that and on associated workbooks in that main workbook. I'll use Personal.xlsb for macros that are used more widely.

  18. #18
    Valued Forum Contributor
    Join Date
    09-30-2018
    Location
    Vlaams Brabant Belgium
    MS-Off Ver
    365
    Posts
    456

    Re: Keeping ALL macros in Personal.xlsb ?

    Ive made myself a ribbon so i have easy access to all macros thats my UI

+ 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. Macros in Personal.xlsb
    By prestone442 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-05-2018, 07:13 PM
  2. Replies: 2
    Last Post: 06-25-2015, 10:57 AM
  3. Replies: 0
    Last Post: 01-15-2015, 05:53 AM
  4. [SOLVED] Copied personal.xlsb to another computer, macros won't execute
    By Rick K in forum Excel General
    Replies: 3
    Last Post: 10-27-2014, 10:19 AM
  5. Edit Option Greyed out on Macros in Personal.xlsb spreadsheet
    By bigboy99 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2012, 02:38 PM
  6. Exported Ribbon won't run macros from PERSONAL.XLSB
    By Sicrates in forum Excel General
    Replies: 1
    Last Post: 06-26-2012, 04:29 AM
  7. Macros in Personal.xlsb not available when Excel is opened from another app
    By Muskett32 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-15-2012, 02:57 AM

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