Add Month to New Sheet

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.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Not sure I understand your question about where to put the code. Why not put it at the end of your code?
 
Upvote 0
try this:
Code:
Range("C3").FormulaR1C1 = "=TEXT(TODAY(),""MMMM"")"

btw when not sure how to do something with VBA try the Macro Recorder
 
Upvote 0

Forum statistics

Threads
1,224,895
Messages
6,181,619
Members
453,057
Latest member
LE102024

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