ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving sheets (https://www.excelbanter.com/excel-programming/356871-moving-sheets.html)

Greg[_25_]

Moving sheets
 
How do I write a macro to move the activesheet to the end of the active
workbook.


Thanks

Greg



Ardus Petus

Moving sheets
 
ActiveSheet.Move After:=Sheets(Sheets.Count)

HTH
--
AP

"Greg" a écrit dans le message de
...
How do I write a macro to move the activesheet to the end of the active
workbook.


Thanks

Greg





ReD-DevIL[_13_]

Moving sheets
 

Sub macro1()

Dim sheetnames() As String
Dim sheetcount As Integer
Dim i As Integer

sheetcount = ActiveWorkbook.Sheets.Count
ReDim sheetnames(1 To sheetcount)
For i = 1 To sheetcount
sheetnames(i) = ActiveWorkbook.Sheets(i).Name
Next i

ActiveWorkbook.ActiveSheet.Select
ActiveWorkbook.ActiveSheet.Move After:=Sheets(sheetcount)
End Sub


--
ReD-DevIL
------------------------------------------------------------------------
ReD-DevIL's Profile: http://www.excelforum.com/member.php...o&userid=32624
View this thread: http://www.excelforum.com/showthread...hreadid=525594



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com