LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Define a variable in Initialize for Userform

Hi Michael,

Should I have put Tester right before
the UpdateForm (see above) to run the subroutine Tester??


It would have been clearer If I had named my sub as Sub
UserForm_Initialize(). The code between Sub Tester() and End Sub, was a
suggestion to replace your shown code.

I am pleased that your code now works but a couple of observations:

It is good programming practice explicitly to declare all variables. In this
connection, see Chip Pearson's detailed observations:

http://www.cpearson.com/excel/DeclaringVariables.htm
and
http://www.cpearson.com/excel/variables.htm

Additionally, from the perspectives of readability and code maintenance, I
would advocate that all variables be declared at the top of the procedure.

I replaced your multiple If ... Then form with a Select Case structure as a
matter of personal predelection rather than to suggest any error.


Regards,
Norman






 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Define Variable Name using VBA GTReferee Excel Discussion (Misc queries) 2 January 21st 09 06:37 PM
Userform Initialize & combo box values michaelberrier Excel Discussion (Misc queries) 3 June 27th 06 04:35 PM
Userform disappears when you try to initialize from a command button RPIJG[_60_] Excel Programming 8 July 2nd 04 08:14 PM
Define variable range acberry Excel Programming 2 May 12th 04 02:44 PM
Generic questions about variable scope the Initialize event TBA[_2_] Excel Programming 4 January 12th 04 03:42 PM


All times are GMT +1. The time now is 08:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"