I have this code place in the Private Sub UserForm_Initialize() procedure. I reference this code in a few other procedure in the same userform, so I decided to reduce the redundancy and place it in the initialization. Sometimes it works but i notice it would create error alert. If I place this code in the procedure of the error, it runs without any issues. Can someone explain why?
Thanks
Run-time error 91
Object Variable or With block variable not set
Set Wks = ActiveSheet