If I could ask a random question. I am using excel for data collection. I have a userform for data entry. Users can also edit rows from the worksheets. Selecting a row and clicking a command button pulls data from the various worksheets into the user form. In the edit module, I declare a user form like Dim UF as New UserForm
. Now in the code, the first assignment of that is UF.Caption = “whatever”
. That first call of UF can take three or four seconds. I’ve used a timer and figured out that all of the other code has a run time in the milliseconds but the first value assignment in the UF, regardless of what it is, is just so slow.
I’ve tried to just Dim US as UserForm
, then in the code Set UF = New UserForm
but then that becomes the slow part. In the user form, I’ve reduced the initialization sub to just position and size. Putting a timer on the initialization code also shows it runs in just a few milliseconds. Nothing else in the form’s code should run until activation.
If Dim UF as New UserForm instantiates UF, then why does it take so long to assign the first value to UF? And How can I speed that up?