Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro to select next and rename

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").Selec
Range("E2").Selec
Selection.Cop
Sheets("Summary").Selec
Range("a34").Selec
Selection.End(xlToRight).Offset(0, 1).Selec
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks
:=False, Transpose:=Fals
Selection.Offset(1, 0).Selec
Sheets("Engine").Selec
Range("D65510:g65536").Selec
Application.CutCopyMode = Fals
Selection.Cop
Sheets("Sheet1").Selec
Range("D65510").Selec
ActiveSheet.Past
Range("F65510:f65536").Selec
Application.CutCopyMode = Fals
Selection.Cop
Sheets("Summary").Selec
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks
:=False, Transpose:=Fals
Sheets("Sheet1").Selec
Sheets("Sheet1").Name = Format(Range("E2").Value, "yyyymmdd"
Sheets("Summary").Selec
Range("a34").Selec

End Su

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.

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
Rename of sheets by macro Harshad[_2_] Excel Discussion (Misc queries) 4 October 17th 08 01:09 PM
Rename Macro rmpete Excel Discussion (Misc queries) 3 February 11th 06 10:24 PM
Can I rename a directory using a macro Harvey[_3_] Excel Programming 2 February 6th 04 01:49 PM
rename file macro dtroupe Excel Programming 1 December 5th 03 12:50 AM
MACRO TO RENAME SHEET ! Jay Dean Excel Programming 1 October 17th 03 08:58 AM


All times are GMT +1. The time now is 06:55 AM.

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

About Us

"It's about Microsoft Excel"