ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro to copy last sheet in workbook (https://www.excelbanter.com/excel-discussion-misc-queries/183215-macro-copy-last-sheet-workbook.html)

Bill_S

macro to copy last sheet in workbook
 
I need a macro to copy the last sheet in my workbook and put the copy at the
very end of the workbook, in effect it becomes the new last sheet. Thanks

Dave Peterson

macro to copy last sheet in workbook
 
Option Explicit
Sub testem()
With Sheets
.Item(.Count).Copy _
after:=.Item(.Count)
End With
End Sub


Bill_S wrote:

I need a macro to copy the last sheet in my workbook and put the copy at the
very end of the workbook, in effect it becomes the new last sheet. Thanks


--

Dave Peterson

Bill_S

macro to copy last sheet in workbook
 
Dave - excellent! I've got a follow-on question. When the new sheet is
created, two of the cells that are populated should be cleared out: the date
cell (E4) and the quote cell (G6.) What should I add to your macro to
accomplish that? thanks.


"Dave Peterson" wrote:

Option Explicit
Sub testem()
With Sheets
.Item(.Count).Copy _
after:=.Item(.Count)
End With
End Sub


Bill_S wrote:

I need a macro to copy the last sheet in my workbook and put the copy at the
very end of the workbook, in effect it becomes the new last sheet. Thanks


--

Dave Peterson


Dave Peterson

macro to copy last sheet in workbook
 
Option Explicit
Sub testme()
With Sheets
.Item(.Count).Copy _
after:=.Item(.Count)
End With
activesheet.range("e4,g6").clearcontents
End Sub



Bill_S wrote:

Dave - excellent! I've got a follow-on question. When the new sheet is
created, two of the cells that are populated should be cleared out: the date
cell (E4) and the quote cell (G6.) What should I add to your macro to
accomplish that? thanks.

"Dave Peterson" wrote:

Option Explicit
Sub testem()
With Sheets
.Item(.Count).Copy _
after:=.Item(.Count)
End With
End Sub


Bill_S wrote:

I need a macro to copy the last sheet in my workbook and put the copy at the
very end of the workbook, in effect it becomes the new last sheet. Thanks


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 09:25 PM.

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