VBA Userform Name

mawood11

New Member
Joined
Mar 31, 2019
Messages
3
I am working on a project where I have numerous userforms and each as a date that auto-populates in a text box, well it used to populate.

I name the userform a custom name, but when I double-click the userform to view the code, it no longer uses the custom name, but rather defaults back to "Userform." Since this started happening, the date no longer auto-populates with the current date. Any halo would would be greatly appreciated.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
I am working on a project where I have numerous userforms and each as a date that auto-populates in a text box, well it used to populate.

I name the userform a custom name, but when I double-click the userform to view the code, it no longer uses the custom name, but rather defaults back to "Userform." Since this started happening, the date no longer auto-populates with the current date. Any halo would would be greatly appreciated.

The code portion of a UserForm always displays "UserForm" in procedure headers... the UserForm's actual name is shown in the title bar for the code window for that UserForm. As for the date not auto-populating, what procedure is the code that should do that in? And, is that code still there?
 
Upvote 0
Thanks for your reply. The name in the title dropdown says "Userform," but the actual custom name is "TaserInfo1." The code I am trying to use is,

Private Sub UserForm_Initialize()
DateOpened.Value = Format (Date, "mm/dd/yyyy")
End Sub

When I execute the form, I get the following error:

Compile Error:
Can't find project or library

And the "Private Sub UserForm_Initialize()" is highlighted in yellow, and the "Date" is highlighted in blue.
 
Upvote 0
I went back and checked previous versions of my project, and everything is the same as the project where the date does not auto populate. The title bar even says Userform, not the custom name, and it works. It has to be something in the newer version.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top