Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Userform with option buttons to print selected sheets

Can anyone help me with code to help me buid a userform in which a user
selects the sheets in the workbook to print using option buttons ?

Once the user has selected the sheets another button prints them

Can anyone help?

Thankyou,

Roger
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Userform with option buttons to print selected sheets

How about using a combo box. Place a combobox and command button in a
userform and try the below code


Private Sub CommandButton1_Click()
ThisWorkbook.Sheets(Me.ComboBox1.Text).PrintOut Copies:=1, Collate:=True
End Sub

Private Sub UserForm_Initialize()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
Me.ComboBox1.AddItem ws.Name
Next
End Sub

--
Jacob


"Roger on Excel" wrote:

Can anyone help me with code to help me buid a userform in which a user
selects the sheets in the workbook to print using option buttons ?

Once the user has selected the sheets another button prints them

Can anyone help?

Thankyou,

Roger

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 449
Default Userform with option buttons to print selected sheets

And if you want multiple choice, use a listbox. Modified code:

Private Sub CommandButton1_Click()
Dim L As Long
For L = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(L) = True Then
ThisWorkbook.Sheets(Me.ListBox1.List(L)).PrintOut Copies:=1, Collate:=True
End If
Next
End Sub

Private Sub UserForm_Initialize()
Dim ws As Worksheet
Me.ListBox1.MultiSelect = fmMultiSelectMulti
For Each ws In ThisWorkbook.Sheets
Me.ListBox1.AddItem ws.Name
Next
End Sub

HTH. Best wishes Harald


"Jacob Skaria" wrote in message
...
How about using a combo box. Place a combobox and command button in a
userform and try the below code


Private Sub CommandButton1_Click()
ThisWorkbook.Sheets(Me.ComboBox1.Text).PrintOut Copies:=1, Collate:=True
End Sub

Private Sub UserForm_Initialize()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
Me.ComboBox1.AddItem ws.Name
Next
End Sub

--
Jacob


"Roger on Excel" wrote:

Can anyone help me with code to help me buid a userform in which a user
selects the sheets in the workbook to print using option buttons ?

Once the user has selected the sheets another button prints them

Can anyone help?

Thankyou,

Roger


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 249
Default Userform with option buttons to print selected sheets

Thanks Harald,

This solution with the list box is perfect for me

Best regards

Roger

"Harald Staff" wrote:

And if you want multiple choice, use a listbox. Modified code:

Private Sub CommandButton1_Click()
Dim L As Long
For L = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(L) = True Then
ThisWorkbook.Sheets(Me.ListBox1.List(L)).PrintOut Copies:=1, Collate:=True
End If
Next
End Sub

Private Sub UserForm_Initialize()
Dim ws As Worksheet
Me.ListBox1.MultiSelect = fmMultiSelectMulti
For Each ws In ThisWorkbook.Sheets
Me.ListBox1.AddItem ws.Name
Next
End Sub

HTH. Best wishes Harald


"Jacob Skaria" wrote in message
...
How about using a combo box. Place a combobox and command button in a
userform and try the below code


Private Sub CommandButton1_Click()
ThisWorkbook.Sheets(Me.ComboBox1.Text).PrintOut Copies:=1, Collate:=True
End Sub

Private Sub UserForm_Initialize()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Sheets
Me.ComboBox1.AddItem ws.Name
Next
End Sub

--
Jacob


"Roger on Excel" wrote:

Can anyone help me with code to help me buid a userform in which a user
selects the sheets in the workbook to print using option buttons ?

Once the user has selected the sheets another button prints them

Can anyone help?

Thankyou,

Roger


.

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
Forms Option Buttons(Can be right mouse selected when sheet is loc Newbeetle Excel Discussion (Misc queries) 2 February 10th 07 04:12 PM
Option buttons: How to get the selected option from a group? naddad Excel Programming 5 December 21st 05 05:09 PM
Counting selected option buttons in column? -JEFF-[_2_] Excel Programming 5 August 26th 05 03:23 AM
SIMPLE UserForm w/ 2 OPTION BUTTONS Chuckles123[_39_] Excel Programming 2 October 11th 04 07:02 PM
SIMPLE UserForm w/ 2 OPTION BUTTONS Chuckles123[_38_] Excel Programming 1 October 11th 04 09:03 AM


All times are GMT +1. The time now is 09:28 PM.

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"