Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting todays date a certain Cell using a command Buttom

Status
Not open for further replies.

GRIFFIJ

Programmer
Aug 29, 2002
43
GB
Hi to you all I was wondering if you could help with a bit of a silly problem I have

I want to put on a spreadsheet a comand button that inserts todays date into a certain cell for example D13

Many thanks Joel
 
GRIFFIJ,
[ol][li]Draw a button on your worksheet using the Froms toolbar.[/li]
[li]When the Assign Macro dialog box pops up click new.[/li]
[li]This should spawn the Visual Basic explorer and present something like this:
Code:
Sub Button1_Click()

End Sub
[/li]
[li]Add the following code to the routine:
Code:
Sub Button1_Click()
[b]ActiveSheet.Range("D13") = Date[/b]
End Sub
[/li][/ol]

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Thank you put it is putting in the time as well how do I get rid of the time
 



FYI...

Why do Dates and Times seem to be so much trouble? faq68-5827

Skip,

[glasses] [red][/red]
[tongue]
 
SkipVought,
Because they are dates and times? You have to love a number that can be base 7, 24, 28-31, 60, 365.25 pretty much all at the same time.

GRIFFIJ,
The [tt]Date()[/tt] function should only return the date. In your spreadsheet is it showing the time as [tt]12:00 AM[/tt]?

CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Why go to all that trouble ... select the cell and press Ctrl ; and then Enter.


Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
Thank you


Can you now help me try and print a range of cells, I don't want all the sheet I just want to print a pre determied area using VBA without printing the actual Command buttons on the sheet

Thanks again I am making a note of your replys so as not to ask the same question twice
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top