Automatic generation of Sheets monthly

RenuSeban

New Member
Joined
Nov 27, 2020
Messages
1
Office Version
  1. 365
  2. 2011
Platform
  1. Windows
  2. Mobile
I would like to generate excel sheet daily based on the previous day entries,is there any way to automate that?
Like First Day of month, one sheet with some financial entries, next day the continuation from next, this will repeat every month.
I know copy sheet from the previous and add link those, but again for the next month another workbook..but is there any way to automate?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
.
The following will create a new workbook at the beginning of the month. It will ask how many days in the month, etc., then
create the workbook. You can add your code for copying from one day to the next, etc.

However, I am confused exactly what you are searching for and believe this code may not be the answer you are seeking.

VBA Code:
Option Explicit

Sub CreateSheets()
    Const lngFirstWorkDay = vbMonday
    Dim lngYear As Long
    Dim lngMonth As Long
    Dim lngOption As Long
    Dim rngHolidays As Range
    Dim d As Date
    Dim wsh As Worksheet
    Dim f As Boolean
    Dim ws As Worksheet
    
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    For Each ws In Application.ActiveWorkbook.Worksheets
        If ws.Name <> "Template" Then
            ws.Delete
        End If
    Next
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
    
    lngYear = Val(InputBox("For which year do you want to create sheets?"))
    
    If lngYear < 2000 Or lngYear > 2100 Then
        MsgBox "Year not valid! Please try again.", vbInformation
        Exit Sub
    End If
    
    lngMonth = Val(InputBox("For which month (1 ... 12) do you want to create sheets?"))
    
    If lngMonth < 1 Or lngMonth > 12 Then
        MsgBox "Month not valid! Please try again.", vbInformation
        Exit Sub
    End If
    
    lngOption = 1
    
    If lngOption < 1 Or lngOption > 1 Then
        MsgBox "Option not valid! Please try again.", vbInformation
        Exit Sub
    End If
    
    Application.ScreenUpdating = False
    
    d = DateSerial(lngYear, lngMonth, 1)
    
    Do
        f = True
        Sheets("Template").Range("A1:Z100").Copy    'adjust range in Template to copy here
        If f Then
            Set wsh = Worksheets.Add(After:=Worksheets(Worksheets.Count))
            wsh.Name = Format(d, "yyyy_mm_dd")
            Range("A1").PasteSpecial xlPasteAll
            Range("A1").PasteSpecial Paste:=xlPasteColumnWidths
            Range("A1").Select
        End If
        
        d = d + 1
    
    Loop Until Month(d) <> lngMonth
    Sheets("Template").Activate
    Sheets("Template").Range("A1").Select
    Application.CutCopyMode = False
    
    Application.ScreenUpdating = True
    
    MsgBox "All Sheets Created", vbExclamation, "Done !"
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,526
Messages
6,114,122
Members
448,550
Latest member
CAT RG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top