none
VBA Issues: Creates 2 modules when recording. RRS feed

  • Question

  • I'm on Excel 2019 32bit on Windows. I'm using the Visual Basic Editor (VBE) but every time I record a module. The software creates 2. One is empty and the second one contains the code. In the past, this was all done with one module. 

    Can someone confirm whether there is a rationale behind this or a bug?  Thanks in Advance


    Saturday, June 15, 2019 8:59 PM

All replies

  • My version of Excel is the following:


    Saturday, June 15, 2019 9:05 PM
  • Here's the code I used so you can recreate the issue:

    1. Enable Developer Tab

    2. Select "Record Macro"

    3. Enter Macro Name: Myname

    4. Enter Shortcut key: Shift + N

    5. Enter Description: Test Macro 001

    6. Select any cell in the worksheet and type your name and press the ENTER key. 

    7. Click the Stop Recording Button on the toolbar

    8. Examine the macro with the ALT + F11 Key to bring up the VBE

    9. Do you see one or two modules?

    10. Where is your code in module 1 or 2? 

    Saturday, June 15, 2019 9:15 PM
  • I had the "Personal" workbook in the startup folder and I think it had an empty module attached to it. 

    I deleted it and the module went away. 

    Saturday, June 15, 2019 9:33 PM
  • This was my subroutine and I have a question to ask about this. 

    Sub MyName()
    '
    ' MyName Macro
    ' Test Macro 003
    '
    ' Keyboard Shortcut: Ctrl+Shift+N
    '
        ActiveCell.FormulaR1C1 = "George"
        Range("A2").Select
    End Sub

    =====

    As soon as I hit the enter key, the macro recorded the next cell. How can I leave out this "Range("A2").Select" or do I have to manually adjust this? VBE recording this minor next steps will mess up my macros if they become really complex. 




    • Edited by ResidentX10 Saturday, June 15, 2019 9:48 PM
    Saturday, June 15, 2019 9:45 PM
  • Closed...I have to edit out the extra code
    Saturday, June 15, 2019 9:52 PM
  • Hi,

    This is the forum to discuss questions and feedback for Microsoft Excel features, I'll move your question to the MSDN forum for Excel

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

    Regards,

    Emi Zhang


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Office 2019.

    Monday, June 17, 2019 2:08 AM