Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Selecting Worksheets from active to end

Hi,

getting stuck on how to select a group of sheets from the active sheet to
the end.

I know activesheet.select picks the current sheet
and Sheets(Sheets.Count).Select picks the last sheet

but what code will select from the active sheet to the last sheet including
all those in between...reason is I want to take that group and move it to a
new book

I saw that Sheets(Array("worksheet 5","worksheet 6", "worksheet7")).select
will pick sheets but my sheet names are constantly changing so I need
variables...

I thought if the activesheet was WSN and the last sheet was called WSL then
Sheets(Array(WSN:WSL)).select would work but I get type mismatch error.

thanks for any assistance.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Selecting Worksheets from active to end

This should get you started

Option Explicit

Sub FindActiveSheetToEnd()

Dim WS As Excel.Worksheet
Dim aWS As Excel.Worksheet

Set aWS = ActiveSheet

For Each WS In ThisWorkbook.Worksheets
If WS.Index aWS.Index Then
'Move worksheet
End If
Next WS

End Sub

HTH, Barb Reinhardt

"Craig" wrote:

Hi,

getting stuck on how to select a group of sheets from the active sheet to
the end.

I know activesheet.select picks the current sheet
and Sheets(Sheets.Count).Select picks the last sheet

but what code will select from the active sheet to the last sheet including
all those in between...reason is I want to take that group and move it to a
new book

I saw that Sheets(Array("worksheet 5","worksheet 6", "worksheet7")).select
will pick sheets but my sheet names are constantly changing so I need
variables...

I thought if the activesheet was WSN and the last sheet was called WSL then
Sheets(Array(WSN:WSL)).select would work but I get type mismatch error.

thanks for any assistance.

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
Selecting cells on active row merry_fay Excel Discussion (Misc queries) 1 May 26th 09 05:30 PM
Selecting a worksheet without making it active ordnance1 Excel Programming 6 February 25th 08 09:51 PM
selecting the currently active column armagan Excel Programming 3 May 25th 06 12:53 PM
Selecting an active cell TimT Excel Programming 3 October 27th 05 07:08 PM
Selecting the active row el_grimley Excel Programming 2 August 5th 05 09:19 AM


All times are GMT +1. The time now is 09:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"