Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Inserting static time that doesn't update | Excel Discussion (Misc queries) | |||
Inserting a static date into a function | Excel Worksheet Functions | |||
Static formula when inserting new rows/columns? | Excel Discussion (Misc queries) | |||
Command Buttons on Sheet moving with cells | Excel Programming | |||
Embedding command buttons in cells | Excel Programming |