Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default vba:Userform

I'd like to know how to make a userform that tells the

user to "Select Worksheets". Worksheet will be displayed

in the listbox as selected. Selected Worksheets will be

stored in an array for future processing, when command

button (Done) is click. Thanks in advance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default vba:Userform

Alex,

Here is some code

Dim arysheets

Private Sub CommandButton1_Click()
Dim i As Long
Dim j As Long

With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
j = j + 1
If j = 1 Then
ReDim arysheets(1 To 1)
Else
ReDim Preserve arysheets(1 To j)
End If
arysheets(j) = .List(i)
End If
Next i
End With

End Sub

Private Sub UserForm_ACtivate()
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
Me.ListBox1.AddItem sh.Name
Next sh
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alex" wrote in message
...
I'd like to know how to make a userform that tells the

user to "Select Worksheets". Worksheet will be displayed

in the listbox as selected. Selected Worksheets will be

stored in an array for future processing, when command

button (Done) is click. Thanks in advance.



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
UserForm bgkgmg Excel Worksheet Functions 1 February 26th 09 04:25 PM
userform always on top? dok112[_34_] Excel Programming 1 October 10th 04 10:43 PM
Linking userform to userform in Excel 2003 missmelis01 Excel Programming 2 August 27th 04 08:07 PM
Userform inside another userform Ryan Excel Programming 0 April 23rd 04 08:01 PM
userform jim apostolidis Excel Programming 1 August 11th 03 10:37 AM


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