cadandcode
Board Regular
- Joined
- Jan 21, 2023
- Messages
- 125
- Office Version
- 2019
- Platform
- Windows
- Mobile
Sorry for my poor English, it is not MIGRATE but COMBINE
First macro (thanks to @Peter_SSs and @shinigamilight) copies and renames last sheet. This is ok.
And I am trying to add this macro I edited to run after copying sheet and renaming it.
My macro edits some rows/columns that I do each day each time.
I want to combine them and use one macro instead using two different macros, time waste.
But macro 1 (copy last sheet and rename date +1) should run first, then my macro that edits copied and renamed sheet inside.
Macro 1, copy and rename
Macro 2, edits some rows/columns (I made it to do its job already, just need to combine)
First macro (thanks to @Peter_SSs and @shinigamilight) copies and renames last sheet. This is ok.
And I am trying to add this macro I edited to run after copying sheet and renaming it.
My macro edits some rows/columns that I do each day each time.
I want to combine them and use one macro instead using two different macros, time waste.
But macro 1 (copy last sheet and rename date +1) should run first, then my macro that edits copied and renamed sheet inside.
Macro 1, copy and rename
VBA Code:
Sub New_Sheet()
Sheets(Sheets.Count).Copy After:=Sheets(Sheets.Count)
With Sheets(Sheets.Count)
.Name = Format(DateValue(Replace(Left(.Name, 8), ".", "/")) + 1, "dd.mm.yy")
End With
End Sub
Macro 2, edits some rows/columns (I made it to do its job already, just need to combine)
VBA Code:
Sub Makroyeni()
'
' Makroyeni Makro
'
'
Range("AC3:AU3").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[1]C"
Range("CW7").Select
ActiveCell.FormulaR1C1 = "1/25/2023"
Range("D13:CU13").Select
Selection.Copy
Range("D11:CU11").Select
ActiveSheet.Paste
Range("D9:CV35").Select
Range("CV9").Activate
Application.CutCopyMode = False
Selection.ClearContents
ActiveWindow.SmallScroll Down:=20
Range("AC39:AU39").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[1]C"
Range("AC40:AU40").Select
ActiveWindow.SmallScroll Down:=30
Range("AC75:AU75").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=R[1]C"
Range("AC76:AU76").Select
ActiveWindow.SmallScroll Down:=15
Range("D81:CV107").Select
Range("CV81").Activate
Selection.ClearContents
ActiveWindow.SmallScroll Down:=30
Range("AC111:AU111").Select
ActiveWindow.SmallScroll Down:=45
Range("AJ147:AQ179").Select
Selection.Copy
Range("AB147:AI147").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("D148:S148").Select
Application.CutCopyMode = False
Selection.Copy
Range("D147:S147").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.AutoFill Destination:=Range("D147:S179"), Type:=xlFillDefault
Range("D147:S179").Select
ActiveWindow.SmallScroll Down:=-165
Range("R14").Select
ActiveWindow.SmallScroll Down:=140
Range("BA147:CW162").Select
Range("BA162").Activate
Selection.ClearContents
ActiveWindow.SmallScroll Down:=-120
Range("D45:CV71").Select
Range("CV45").Activate
Selection.ClearContents
ActiveWindow.SmallScroll Down:=20
Range("D81:CV107").Select
Range("CV81").Activate
Selection.ClearContents
ActiveWindow.SmallScroll Down:=-55
Range("D9:CV35").Select
Range("CV9").Activate
Selection.ClearContents
Selection.ClearContents
Range("I12").Select
End Sub