Hi
I am trying to allow users to select the pages they would like to print - I have devoped the list box with the choices and employed the code below. I have initially sort for the selection to be pasted in a cell and then I would transfer this to the print sheet array code. However, the result in the cell comes in a format which is broken up by a "box" style symbol between each selection and which the find, edit, replace etc does not work. Can someone please help. See code below.
thanks
Ron
Option Explicit
Private Sub obMulti_Click()
ListBox1.MultiSelect = fmMultiSelectMulti
End Sub
Private Sub OKButton_Click()
Dim Result As String
Dim i As Integer
If ListBox1.ListIndex = -1 Then
Result = "Nothing"
Else
Result = ""
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then _
Result = Result & ListBox1.List(i) & vbCrLf
Next i
End If
Sheets("sheet1").Range("a7") = vbCrLf & Result
Unload Me
End Sub
The userform code is:
Sub Printpagelist()
With UserForm1.ListBox1
.MultiSelect = fmMultiSelectSingle
.RowSource = ""
.AddItem "January"
.AddItem "February"
.AddItem "March"
.AddItem "April"
.AddItem "May"
.AddItem "June"
.AddItem "July"
.AddItem "August"
.AddItem "September"
.AddItem "October"
.AddItem "November"
.AddItem "December"
End With
UserForm1.Show
End Sub
Bookmarks