I have two VBA codes I found. One to auto populate dates in tab and I have the VBA code for duplicate sheets. How do I combine the two or what code needs to be written to work in VBA using macros? I'm not sure where to start. ' Code Starts here

Sub Dtpopulate()


Dim S As Integer

Dim X As Integer

S = Sheets("Temp").Range("c5").Value



For X = 1 To S

newname = Sheets("Temp").Range("a6").Value

Sheets.Add Type:=xlWorksheet

ActiveSheet.Name = newname

Sheets("Temp").Range("d5").Value = Sheets("Temp").Range("a5") - X

Next X

End Sub

Create a sheet and rename it to "Template"



Sub Dtpopulate()

Dim S As Integer
Dim X As Integer
S = Sheets("Temp").Range("c5").Value

For X = 1 To S

newname = Sheets("Temp").Range("a6").Value

 Worksheets("Template").Activate
   Sheets("Template").Cells.Select
Selection.Copy

   
Sheets.Add.Name = newname
    Sheets(newname).Cells.Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, 
Operation:= _
    xlNone, SkipBlanks:=False, Transpose:=False

Selection.PasteSpecial Paste:=xlPasteFormats, 
Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False


Sheets("Temp").Range("d5").Value = Sheets("Temp").Range("a5") - X

Next X



End Sub
0

There are 0 best solutions below