Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 385
Default Selections fill a form

Hi Guys,
I have a listbox that the user can make any number of selections
(multiSelect)then click the cmdSelect button and have it fill another form
with labels from the selections. The following code uses the selections but
on the form i have to have say 10 labels already set up to be filled and i
don't always need 10. I may only need to fill 3 labels with the selections
from the list box. Across from the labels i want to have textbox for the user
to enter a value. Have any ideas or have i confused everyone. Thank you so
much for any help or direction.

Private Sub cmdSelect_Click()
Dim i As Long
Dim SelCount As Long

With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
SelCount = SelCount + 1
UserForm1.Controls("Label" & SelCount).Caption = .List(i)
End If
Next
End With

UserForm1.Show
End Sub
--
Thank you,

Jennifer
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Selections fill a form

You don't need selcount because it is "i + 1" . I believe you can make the
controls visible or not visible.


Private Sub cmdSelect_Click()
Dim i As Long

With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i + 1) = True Then
UserForm1.Controls("Label" & (i + 1)).Caption = .List(i)
UserForm1.Controls("Label" & (i + 1)).visible = True
else
UserForm1.Controls("Label" & (i + 1)).visible = False
End If
Next
End With

UserForm1.Show
End Sub

"Jennifer" wrote:

Hi Guys,
I have a listbox that the user can make any number of selections
(multiSelect)then click the cmdSelect button and have it fill another form
with labels from the selections. The following code uses the selections but
on the form i have to have say 10 labels already set up to be filled and i
don't always need 10. I may only need to fill 3 labels with the selections
from the list box. Across from the labels i want to have textbox for the user
to enter a value. Have any ideas or have i confused everyone. Thank you so
much for any help or direction.

Private Sub cmdSelect_Click()
Dim i As Long
Dim SelCount As Long

With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
SelCount = SelCount + 1
UserForm1.Controls("Label" & SelCount).Caption = .List(i)
End If
Next
End With

UserForm1.Show
End Sub
--
Thank you,

Jennifer

Reply
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
Setting cell selections in form spreadsheet kentuckyjo Excel Worksheet Functions 1 June 10th 09 03:27 AM
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
Fill in form to type Item descrictions and costs and fill in funct cradino Excel Worksheet Functions 0 July 16th 06 08:44 PM
how to get a data form to fill you own exel sheet (was data-form erik van buijtenen Excel Worksheet Functions 2 May 30th 06 05:31 PM
Saving User Selections made on a Form DMS Excel Programming 1 December 1st 04 01:22 AM


All times are GMT +1. The time now is 02:43 AM.

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

About Us

"It's about Microsoft Excel"