MasterChief
Board Regular
- Joined
- Feb 14, 2006
- Messages
- 172
I use the following code to add a new sheet to my workbook which works great,
Sub AddNameNewSheet2()
'Remember where we started
'Not needed if you don't want to return to where you started but want
'to stay on the New Sheet
Dim CurrentSheetName As String
CurrentSheetName = ActiveSheet.Name
'Add New Sheet
Sheets.Add
'Make sure the name is valid
On Error Resume Next
'Get the new name
ActiveSheet.Name = InputBox("Name for new worksheet?")
'Keep asking for name if name is invalid
Do Until Err.Number = 0
Err.Clear
ActiveSheet.Name = InputBox("Try Again!" _
& vbCrLf & "Invalid Name or Name Already Exists" _
& vbCrLf & "Please name the New Sheet")
Loop
On Error GoTo 0
'Go back to where you started
'Not needed if you don't want to return to where you started but want
'to stay on the New Sheet
Sheets(CurrentSheetName).Select
End Sub
what i want to do is add this to the code to fill in the currant month in cell C3, but I`m not sure where to place it.
=TEXT(TODAY(),"MMMM")
Any help would be greatfull.
Sub AddNameNewSheet2()
'Remember where we started
'Not needed if you don't want to return to where you started but want
'to stay on the New Sheet
Dim CurrentSheetName As String
CurrentSheetName = ActiveSheet.Name
'Add New Sheet
Sheets.Add
'Make sure the name is valid
On Error Resume Next
'Get the new name
ActiveSheet.Name = InputBox("Name for new worksheet?")
'Keep asking for name if name is invalid
Do Until Err.Number = 0
Err.Clear
ActiveSheet.Name = InputBox("Try Again!" _
& vbCrLf & "Invalid Name or Name Already Exists" _
& vbCrLf & "Please name the New Sheet")
Loop
On Error GoTo 0
'Go back to where you started
'Not needed if you don't want to return to where you started but want
'to stay on the New Sheet
Sheets(CurrentSheetName).Select
End Sub
what i want to do is add this to the code to fill in the currant month in cell C3, but I`m not sure where to place it.
=TEXT(TODAY(),"MMMM")
Any help would be greatfull.