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


I'm making a form to protect all sheets or all selected sheets with
password but trying this I found a problem.
How can I know all selected sheets at moment of begin the action t
apply code only to them ?

Thanks and Regards
Daniel

--
dbarell
-----------------------------------------------------------------------
dbarelli's Profile: http://www.excelforum.com/member.php...fo&userid=3127
View this thread: http://www.excelforum.com/showthread.php?threadid=57088

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to Know Selected Sheets

dim wks as worksheet

for each wks in activewindow.selectedsheets
'your code
next wks



dbarelli wrote:

I'm making a form to protect all sheets or all selected sheets with a
password but trying this I found a problem.
How can I know all selected sheets at moment of begin the action to
apply code only to them ?

Thanks and Regards
Daniel.

--
dbarelli
------------------------------------------------------------------------
dbarelli's Profile: http://www.excelforum.com/member.php...o&userid=31275
View this thread: http://www.excelforum.com/showthread...hreadid=570888


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default How to Know Selected Sheets

Give this a try...

Sub SelectedSheets()
Dim wks As Worksheet

For Each wks In ActiveWindow.SelectedSheets
MsgBox wks.Name
Next wks
End Sub

--
HTH...

Jim Thomlinson


"dbarelli" wrote:


I'm making a form to protect all sheets or all selected sheets with a
password but trying this I found a problem.
How can I know all selected sheets at moment of begin the action to
apply code only to them ?

Thanks and Regards
Daniel.


--
dbarelli
------------------------------------------------------------------------
dbarelli's Profile: http://www.excelforum.com/member.php...o&userid=31275
View this thread: http://www.excelforum.com/showthread...hreadid=570888


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default How to Know Selected Sheets

Sorry... Don't use that procedure name as it is a reserved word (One of the
properties of the Activewindow as we can see from the code). Change it to
something else like...

Sub MySelectedSheets()
Dim wks As Worksheet

For Each wks In ActiveWindow.SelectedSheets
MsgBox wks.Name
Next wks
End Sub

--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

Give this a try...

Sub SelectedSheets()
Dim wks As Worksheet

For Each wks In ActiveWindow.SelectedSheets
MsgBox wks.Name
Next wks
End Sub

--
HTH...

Jim Thomlinson


"dbarelli" wrote:


I'm making a form to protect all sheets or all selected sheets with a
password but trying this I found a problem.
How can I know all selected sheets at moment of begin the action to
apply code only to them ?

Thanks and Regards
Daniel.


--
dbarelli
------------------------------------------------------------------------
dbarelli's Profile: http://www.excelforum.com/member.php...o&userid=31275
View this thread: http://www.excelforum.com/showthread...hreadid=570888


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Know Selected Sheets


It was more easy than I think.
Thanks a lot !!

Dany.


--
dbarelli
------------------------------------------------------------------------
dbarelli's Profile: http://www.excelforum.com/member.php...o&userid=31275
View this thread: http://www.excelforum.com/showthread...hreadid=570888



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Know Selected Sheets


I want to create a new workbook and insert two selected sheets. Any
ideas?
Chuckles123


--
Chuckles123
------------------------------------------------------------------------
Chuckles123's Profile: http://www.excelforum.com/member.php...o&userid=14948
View this thread: http://www.excelforum.com/showthread...hreadid=570888

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to Know Selected Sheets

without too much info to go on...

Option Explicit
Sub testme()

Dim wkbk As Workbook
Dim newwkbk As Workbook

Set wkbk = Workbooks("book1.xls")

Set newwkbk = Workbooks.Add

wkbk.Worksheets(Array("sheet1", "sheet3")).Copy _
befo=newwkbk.Worksheets(1)

End Sub



Chuckles123 wrote:

I want to create a new workbook and insert two selected sheets. Any
ideas?
Chuckles123

--
Chuckles123
------------------------------------------------------------------------
Chuckles123's Profile: http://www.excelforum.com/member.php...o&userid=14948
View this thread: http://www.excelforum.com/showthread...hreadid=570888


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Know Selected Sheets


Thanks very much, Dave.
I have some add'l code this query that I would like to run by you
-- I will respond to the thread that I originated last nite.

Chuckles123


--
Chuckles123
------------------------------------------------------------------------
Chuckles123's Profile: http://www.excelforum.com/member.php...o&userid=14948
View this thread: http://www.excelforum.com/showthread...hreadid=570888

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to Know Selected Sheets

If you mean create a workbook with two selected sheets, just

wkbk.Worksheets(Array("sheet1", "sheet3")).Copy

--
Regards,
Tom Ogilvy


"Chuckles123"
wrote in message
...

Thanks very much, Dave.
I have some add'l code this query that I would like to run by you
-- I will respond to the thread that I originated last nite.

Chuckles123


--
Chuckles123
------------------------------------------------------------------------
Chuckles123's Profile:
http://www.excelforum.com/member.php...o&userid=14948
View this thread: http://www.excelforum.com/showthread...hreadid=570888



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Know Selected Sheets


Thanks for your post, Tom.
Chuckles12

--
Chuckles12
-----------------------------------------------------------------------
Chuckles123's Profile: http://www.excelforum.com/member.php...fo&userid=1494
View this thread: http://www.excelforum.com/showthread.php?threadid=57088

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
Hide all sheets but selected sheets - an example [email protected] Excel Programming 1 April 7th 06 06:29 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Programming 6 March 29th 06 12:43 PM
Selected Sheets Glen Mettler[_4_] Excel Programming 6 February 21st 05 09:25 PM
printing selected sheets andy Excel Programming 2 December 8th 04 09:59 PM


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