austinpcherry
New Member
- Joined
- Feb 26, 2014
- Messages
- 36
I would like to create a button to dynamically make a sheet for each day of the next month and rename it to the day.
I am having trouble obtaining an accurate number for the days in next month. I can't really move forward until this variable is defined. I am sure it is something simple that I am just overlooking.
I appreciate the help in advance.
I am having trouble obtaining an accurate number for the days in next month. I can't really move forward until this variable is defined. I am sure it is something simple that I am just overlooking.
I appreciate the help in advance.
Code:
Sub NewMonth()
Dim nextMonth As String
Dim daysInNextMonth As Double
nextMonth = Month(Now) + 1
Application.ScreenUpdating = False
Workbooks.Add
ActiveWorkbook.SaveAs "C:\Group Documents\TRUCK LOG\TRUCK LOG\ SERETEAN TRUCK LOG " & MonthName(nextMonth, True) & " " & Year(Now), xlOpenXMLWorkbookMacroEnabled
Application.DisplayAlerts = False
Worksheets("Sheet2").Delete
Worksheets("Sheet3").Delete
Application.DisplayAlerts = True
[COLOR=#ff0000]daysInNextMonth= ??????????[/COLOR]
Worksheets.Add Count:=daysInNextMonth - 1
'........... More to follow .........
Application.ScreenUpdating =True
End Sub