Hello chin67326,
I just completed a project where I needed my UserForm to remember user selections without using a separate file or worksheet.
There are 3 parts to the process. Each embedded value is declared twice: Once as a Variable and again as a Constant. The third piece is a function that modifies the macro code for the constant declaration using the VBIDE.
During the UserForm_Initialize() Event, the Variable is set to the Constant value. Each time the Variable is changed, the function to modify the Constant needs to called to save it for next time.
I will work on creating a workbook to do what you want and post it in this thread for you. I should be able to finish it tonight.
Function to Change a Constant value in the Macro Module's Code
In my case, this macro function changes the constants in the same module the function is in. - Be sure to add the Keyword "Public" before your constants.
- Change the name in blue to the name of your module.
- This function accepts both String and Long type constants.
Bookmarks