LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default UserForm Query

UserForm Query

I have a User Form which is used to collect monthly cost information for a
five year period for a database. The start month and year of the five year
period will vary from record to record.

Intially the user enters the start month and start year into separate Text
Boxes. From this information I have created an Array, strMonthLabels(60),
which contains each month and year for the five year period; i.e. "Jan 2009",
"Feb 2009", etc.

Each of the Text Boxes to capture the month cost information has an adjacent
Label to signify the month and year so that the user can enter the data
correctly. These Labels are named lblMonth1 through to lblMonth60.

I want to be able to use a For-Next Loop to change the Captions on each of
the Labels. The following indicates my intententions but does not work.

For i = 1 To 60
lblMonth(i).Caption = strMonthLabels(i)
Next

An alternative I have tried unsuccessfully is to create a Label variable

Dim objLabelName As Label

and then a value for this variable

objLabelName = "lblMonth" + Trim(Str(i))
objLabelName.Caption = strMonthLabels(i)

The answer is probably staring me in the face!

Please can you advise how to use a For-Next Loop to move from Label to Lable
to change each caption?

Many thanks

--
Derek Dowle
 
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
userform query Gemz Excel Programming 2 February 27th 08 09:04 PM
Userform - Query Help Please Mark Campbell Excel Programming 2 January 29th 07 10:40 PM
Another UserForm query Phil1982 Excel Programming 1 March 16th 06 10:21 PM
Another UserForm query Phil1982 Excel Programming 1 March 16th 06 02:01 PM
Query Results to UserForm Noel Excel Programming 1 September 29th 04 07:09 PM


All times are GMT +1. The time now is 06:37 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"