+ Reply to Thread
Results 1 to 9 of 9

Over populated vba code from macro recording

Hybrid View

  1. #1
    Registered User
    Join Date
    04-10-2022
    Location
    Brisbane, Australia
    MS-Off Ver
    365
    Posts
    5

    Over populated vba code from macro recording

    I have recorded a macro that will hide a column, copy the sheet and then go back to the original sheet and unhide the column. The trouble is the macro is bloated by this line: ActiveSheet.Buttons.Add(1671, 95.25, 155.25, 27).Select.
    The workbook is totally free of buttons and is still saved as an xlsx file.
    I get the same result when file is saved as xlsm.

    Sorry getting used to forum: See reply for new file.
    Last edited by Morten RB; 08-02-2022 at 07:14 AM.

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,767

    Re: Over populated vba code from macro recording

    There is no macro in attached file.
    Edit your post and paste a macro code or attached file with macro (xlsm).
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Registered User
    Join Date
    04-10-2022
    Location
    Brisbane, Australia
    MS-Off Ver
    365
    Posts
    5

    Re: Over populated vba code from macro recording

    Sorry my bad, try this one. Same problem as above.
    Last edited by Morten RB; 08-03-2022 at 06:29 AM.

  4. #4
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    293

    Re: Over populated vba code from macro recording

    You worksheet is covered in buttons, about a 1000 of them. I was wondering why it took ages to open.

    Scroll over to the right and you'll see them all.

  5. #5
    Registered User
    Join Date
    04-10-2022
    Location
    Brisbane, Australia
    MS-Off Ver
    365
    Posts
    5

    Re: Over populated vba code from macro recording

    So where did they all come from? I certainly didn't create them.

  6. #6
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    293

    Re: Over populated vba code from macro recording

    Looking at the Macro, it looks like you created them while recording the macro. Not sure if you were hitting the wrong key by accident, but they were definitely created when you recorded the macro.

  7. #7
    Registered User
    Join Date
    04-10-2022
    Location
    Brisbane, Australia
    MS-Off Ver
    365
    Posts
    5

    Re: Over populated vba code from macro recording

    Thank you for finding that, I wouldn't have thought to look over there. I guess fresh eyes are the key.

  8. #8
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    293

    Re: Over populated vba code from macro recording

    No problem. It's nothing the delete button can't fix, just delete those lines out of your code and you should be good.

  9. #9
    Registered User
    Join Date
    04-10-2022
    Location
    Brisbane, Australia
    MS-Off Ver
    365
    Posts
    5

    Re: Over populated vba code from macro recording

    I just deleted all the buttons and rerecorded the macro and all is good, it was very frustrating at the time though....

+ 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. Unable to edit macro recording code to be a relative code.
    By holaitsme in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2014, 10:51 AM
  2. change macro code generated through recording
    By abraham30 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2013, 02:38 AM
  3. [SOLVED] Instances where macro recording cannot be used to generate code
    By SynGC in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-01-2012, 04:55 AM
  4. hard code the number of rows used with R1C1 macro recording
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2012, 01:46 AM
  5. Cleaning up the code after recording a macro.
    By AnthonyWB in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-01-2010, 02:30 PM
  6. Simplify VBA code for autofilter from Macro recording
    By miners in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-27-2009, 09:58 PM
  7. VBA Code vs Macro Recording code
    By JoeSharp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-10-2007, 11:17 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