Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inserting static times into cells using command buttons

Does anyone know how to do the above? Or have a piece of visual basic code
that i could adapt to do this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Inserting static times into cells using command buttons

The first macro create the button:

Sub Macro1()
ActiveSheet.Buttons.Add(369.75, 65.25, 44.25, 22.5).Select
Selection.OnAction = "staticc"
End Sub


The second macro puts the time into a cell:

Sub staticc()
Range("A1").Value = Time
End Sub
--
Gary's Student


"rossmac2" wrote:

Does anyone know how to do the above? Or have a piece of visual basic code
that i could adapt to do this?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Inserting static times into cells using command buttons


rossmac2 wrote:

Does anyone know how to do the above? Or have a piece of visual basic code
that i could adapt to do this?


Where are the button? On plan or in a Form?
Somehow or other try:

Private Sub CommandButton1_Click()
Range("A1").Value = Time
End Sub

Cheers,

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default Inserting static times into cells using command buttons

I'll assume you know nothing about macro's so forgive me if this is too simple.
Open your workbook, then press Alt+F11, which opens the VBA editor
Go to Insert, Module
In the code window that appears paste this code:
Sub AddTime()
ActiveCell = Now()
End Sub

Go back to Excel
From the "Forms" Toolbar, create a Command Button
When Excel asks you what macro to run with this button,
choose "AddTime"
Select the cell you want the time in and Click the button
--
Charles Chickering

"A good example is twice the value of good advice."


"rossmac2" wrote:

Does anyone know how to do the above? Or have a piece of visual basic code
that i could adapt to do this?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting static time that doesn't update kefee85 Excel Discussion (Misc queries) 1 February 13th 09 08:15 PM
Inserting a static date into a function FIF780 Excel Worksheet Functions 5 February 1st 07 10:39 PM
Static formula when inserting new rows/columns? nfe Excel Discussion (Misc queries) 4 May 2nd 06 02:55 PM
Command Buttons on Sheet moving with cells Todd Huttenstine[_2_] Excel Programming 4 November 30th 03 09:23 PM
Embedding command buttons in cells Andy Excel Programming 3 November 25th 03 11:37 PM


All times are GMT +1. The time now is 06:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"