Hi onbeillp111,
The following 'Ordinary Code Module' code also in the attached file needs the following prerequisites:
Prerequisites (one time only activation required):
1. Enable programmatic access to the VBA Project (runtime Error 1004 [Programmatic access to Visiual Basic is NOT TRUSTED] if not done).
In Excel 2003 and earlier, go the Tools menu (in Excel, not in the VBA editor),
choose Macros and then the Security item. In that dialog,
click on the Trusted Publishers tab and check the Trust access to the Visual Basic Project setting.
In Excel 2007+, click the 'Developer' item on the main Ribbon and then click the 'Macro Security' item
in the Code panel. In that dialog, choose Macro Settings and check the Trust access to
the VBA project object model.
2. Enable Microsoft Visual Basic For Applications Extensibility 5.3.
Generates Compile error: [User-defined type not defined] if not done.
In the VBA editor, go the the 'Tools' menu and choose 'References'.
In that dialog, scroll down to and check the entry for
Microsoft Visual Basic For Applications Extensibility 5.3
or
'Left Click' the 'Enable 'Microsoft Visual Basic For Applications Extensibility 5.3' Library Reference CommandButton.
In an ordinary Code Module:
Lewis
Bookmarks