Using TODAY() function to title a worksheet
Using TODAY() function to title a worksheet
(OP)
I am writing a program in VBA where I want the macro to run a daily result to create a new worksheet titled: "today's date" Orders
I know how to use the functions today() and now() within Excel, but I can't figure out the code to make it title the worksheet with the current date.
Can anyone can help?
Thanks
SDFreed
I know how to use the functions today() and now() within Excel, but I can't figure out the code to make it title the worksheet with the current date.
Can anyone can help?
Thanks
SDFreed





RE: Using TODAY() function to title a worksheet
Sub Macro1()
sheetname = Date
namelength = Len(sheetname)
For t = 1 To namelength
If Mid$(sheetname, t, 1) = "/" Then
sheetname = Left$(sheetname, t - 1) & "." & Right$(sheetname, namelength - t)
End If
Next
Sheets.Add
ActiveSheet.Name = sheetname
End Sub
RE: Using TODAY() function to title a worksheet
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 11/19/2003 by DBP
'
'
Range("a1").Value = "= TEXT(TODAY(), ""mmm dd yyy"") & "" REPORT"""
Range("A1:J1").Select
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub
Cheers,
KE4GFM
RE: Using TODAY() function to title a worksheet
Sub report()
sheetname = "Report " & Left((Now), 2) & "-" & Mid((Now), 4, 2) & "-" & Mid((Now), 9, 2)
Sheets.Add
ActiveSheet.Name = sheetname
End Sub
m777182