Add Date formula to Macro

Firecop1348

Board Regular
Joined
Oct 24, 2009
Messages
101
Excel 03
I have a templet workorder that I copy and use every day. In cell "e6" I have the formula =today() so it puts todays date in all my new workorders I make. (laugh now) :rofl: You all know whats happening and I didnt catch it until today. YES, Every time I open my workbook all my sheets change the date to todays date. YOU=:rofl: Me=:banghead: Well I took out the formula and tried adding it to my macro but keep coming up with a compile error : sub or function not defined. Could some one please help me in adding =today() to cell "E6 in the following Macro Notice I added it but keep getting errors and tried it in many different ways.

HTML:
Sub NewWO()
Sheets("work order").Copy After:=Sheets("work order")
With ActiveSheet
    .Name = InputBox("Enter sheet name")
    .Range("E5").Value = .Name
    .Range("E6").Value = TODAY()     <---- added
    Range("b9").Select
End With
End Sub
thank you, I really try not to abuse the forum and work things out with books but some thing just need experince.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
that worked. Thank you, Im just wondering why it would not work with the =today.

Thank you again.

I am quite new to VBA etc, but I have found that some formula functions wont work in VBA and have different names.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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