Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Rename of sheets by macro | Excel Discussion (Misc queries) | |||
Rename Macro | Excel Discussion (Misc queries) | |||
Can I rename a directory using a macro | Excel Programming | |||
rename file macro | Excel Programming | |||
MACRO TO RENAME SHEET ! | Excel Programming |