referencing sheets

  • Thread starter Thread starter libby
  • Start date Start date
L

libby

How do I reference the last worksheet in a workbook so
that the most recently added sheet is affected by my macro.

I've tried worksheets(sheet.count + 1)
but that doesn't seem to work.



Also how can I get my inserted sheet to always be on the
far right. They seem to pop in randomly at the moment.


Cheers guys
 
I've tried worksheets(sheet.count + 1)
You are close

Sheets(Sheets.Count).Select

Change Sheets to Worksheets if you have also Chart sheets in the workbook
 
This code goes in the Workbook module.

Private Sub Workbook_NewSheet(ByVal Sh As Object)
Sh.Move After:=Worksheets
(ThisWorkbook.Worksheets.Count)
End Sub

Is this what you were looking for?

-Brad
 
Back
Top