View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default macro to select next and rename

Hi
without looking at your code mybe something like
if activesheet.index <activeworkbook.worksheets.count then
'your code
end if

--
Regards
Frank Kabel
Frankfurt, Germany


cwilson wrote:
I want the Macro to do this only if the sheet is not the last sheet
in the workbook. It is knind of meesy, but is what I have so far:

Sheets("Sheet1").Select
Range("E2").Select
Selection.Copy
Sheets("Summary").Select
Range("a34").Select
Selection.End(xlToRight).Offset(0, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _ :=False, Transpose:=False
Selection.Offset(1, 0).Select
Sheets("Engine").Select
Range("D65510:g65536").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D65510").Select
ActiveSheet.Paste
Range("F65510:f65536").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Summary").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _ :=False, Transpose:=False
Sheets("Sheet1").Select
Sheets("Sheet1").Name = Format(Range("E2").Value, "yyyymmdd")
Sheets("Summary").Select
Range("a34").Select

End Sub

This workbook is updated weekly by adding additional sheets (Sheet1,
(2), (3), etc). I don't want to manually rename each new sheet to
update the workbook. The last sheet in the WB is named Caboose and
it is needed (I think) for some SUM(Engine:Caboose) formulas.

Thanks in advance for the help.