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


Hi
I would like the result in a cell to select the array of sheets. For
eg, if cell A1 on sheet1 = "sheet1","sheet2","sheet3", I would like all
3 sheets to be selected. So far I have tried:
Sheets(Array(Sourceprint).Select

with Sourceprint being the name defined for that cell (in this case A1
on sheet1) which gives a error

thanks
Ron


--
Sagaron
------------------------------------------------------------------------
Sagaron's Profile: http://www.excelforum.com/member.php...o&userid=24643
View this thread: http://www.excelforum.com/showthread...hreadid=382314

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Page Selection

Ron,

It's a little tricky.
The Split function returns an array, however
it is not available in Excel 97.
'-----------------------
Sub TestSelection()
Dim strNames As Variant
strNames = Range("Sourceprint").Value
strNames = Split(strNames, ",", -1, vbTextCompare)
Sheets(strNames).Select
End Sub
'---------------------

Jim Cone
San Francisco, USA


"Sagaron" wrote in
message ...
Hi
I would like the result in a cell to select the array of sheets. For
eg, if cell A1 on sheet1 = "sheet1","sheet2","sheet3", I would like all
3 sheets to be selected. So far I have tried:
Sheets(Array(Sourceprint).Select

with Sourceprint being the name defined for that cell (in this case A1
on sheet1) which gives a error
thanks
Ron
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Page Selection


Brilliant - I can understand what you mean by tricky - thanks for you
help

--
Sagaro
-----------------------------------------------------------------------
Sagaron's Profile: http://www.excelforum.com/member.php...fo&userid=2464
View this thread: http://www.excelforum.com/showthread.php?threadid=38231

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Page Selection

Another suggestion (based on one of your previous posts is to build that array
of worksheet names and then use that:

Option Explicit
Private Sub UserForm_Initialize()
Dim wks As Worksheet

For Each wks In ActiveWorkbook.Worksheets
Me.ListBox1.AddItem wks.Name
Next wks

Me.ListBox1.MultiSelect = fmMultiSelectMulti
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()

Dim Result() As String
Dim i As Long
Dim j As Long

ReDim Preserve Result(0 To Me.ListBox1.ListCount - 1)

j = -1
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
j = j + 1
Result(j) = ListBox1.List(i)
End If
Next i

If j = -1 Then
'do nothing, nothing selected
Else
ReDim Preserve Result(0 To j)
ActiveWorkbook.Worksheets(Result).PrintOut
End If

Unload Me

End Sub




Sagaron wrote:

Brilliant - I can understand what you mean by tricky - thanks for your
help!

--
Sagaron
------------------------------------------------------------------------
Sagaron's Profile: http://www.excelforum.com/member.php...o&userid=24643
View this thread: http://www.excelforum.com/showthread...hreadid=382314


--

Dave Peterson
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
On a sheet selection as a web page how do you embed mp3 Sportinus Excel Discussion (Misc queries) 0 January 26th 10 04:14 PM
Group page selection and deselection Gene Augustin Excel Discussion (Misc queries) 2 February 5th 09 02:58 PM
fit to one page selection creates one page for each cell breadman Excel Discussion (Misc queries) 0 June 1st 07 01:54 PM
How do I get my page selection to print on one page? Stefan in NM Excel Discussion (Misc queries) 1 April 19th 06 07:54 PM
how do I link radio button selection to another page Sharon Excel Worksheet Functions 0 April 27th 05 09:29 PM


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