O/T Calling all I.T types

O/T Calling all I.T types

Author
Discussion

torqemada

Original Poster:

168 posts

272 months

Thursday 25th July 2002
quotequote all
This is a call for help, how the hell do I; someone with about as much IT knowledge as Jordan has scruples, set up a macro in an Excel worksheet. All I want it to do is automatically enter the current date into a specified field when you open the worksheet. Then print on a local printer at the same time as sending the sheet to a pre-set recipient via outlook? I have spent two hours looking for useful help in MS, and what a load of bollox that is. If anyone is bored or feels like helping an individual who is shortly going to be reduced to throwing his desktop out the the third floor window on top the the Finance Directors Audi TT (on second thoughts I've never liked the TT anyway) then please, please can I have simple; and I mean simple help. Thanx

incorrigible

13,668 posts

267 months

Thursday 25th July 2002
quotequote all
You'd be better off with the VBA help (Alt +F11, gets you to the editor) sorry haven't got more time, maybe tomorrow
Ben

torqemada

Original Poster:

168 posts

272 months

Thursday 25th July 2002
quotequote all
Does this make sense to anyone?
Will it put the date into a field for me? If what will?


Sub Macro1()
'
Macro1 Macro
' Macro recorded 25/07/2002 by Preferred Customer
'
' Keyboard Shortcut: Ctrl+D
'
Range("B3:C3").Select
ActiveCell.FormulaR1C1 = "date"
Range("D3").Select
End Sub

I've had enough of this PC for today

billb

3,198 posts

271 months

Thursday 25th July 2002
quotequote all
aaaah far too complicated - just do insert,function,date and time,today to get the current date and save that as yer normal template

then record a macro for the other bit

MajorClanger

749 posts

276 months

Thursday 25th July 2002
quotequote all
Something like:

Either set the formula for cell C3 (or wherever you want the date) as "=Now()" (without the quotes) your sheet will always show the current date.

Sub Macro1()
ActiveWindow.SelectedSheets.PrintOut
ActiveWorkbook.SendMail Recipients:="preferred.customer@domain.co.uk", Subject:="Spreadsheet"
End Sub

If you want to keep that date to show the last time you ran the macro then copy the cell and use the paste special function to paste the value. And if you do all that with your macro recorder on, you can insert the code in to the above!!

like:

Sub Macro2()
' You choose cell address C3 for the location where you want the date
Range("C3").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Selection.Copy
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
ActiveWindow.SelectedSheets.PrintOut
ActiveWorkbook.SendMail Recipients:="preferred.customer@domain.co.uk", Subject:="Spreadsheet"
End Sub

MC

>> Edited by MajorClanger on Thursday 25th July 17:09

torqemada

Original Poster:

168 posts

272 months

Friday 26th July 2002
quotequote all
Thanks I'll give it a go.