how to insert a date when a button is clicked

Fireblade954

New Member
Joined
Jun 3, 2015
Messages
3
Hi,

I'm trying to create a simple spreadsheet in Excel 2000 to record routine daily checks at work. I want to insert a button from the forms menu and when I click the button I want it to insert the date it was clicked into the next cell.

I'm pretty much a complete novice with excel and have search the web for an answer but I can't get my head around macros and VBA codes :confused:

Any help would be appreciated.

Thanks!!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi,

Put a button from the forms menu on the worksheet and when you've done that you'll immediately get a popup, click New and attach this code. Not that Excel will already have created the first and last lines of this code.


Code:
Sub Button1_Click()
ActiveCell.Value = Date
End Sub
 
Upvote 0
Thanks, that's sort of what I'm after but still not exactly what I need.

I notice that the date appears in whatever cell is highlighted, can it be modified to only appear in the cell beside it? For example - if I click the button in A2 i need the date to be entered into B2 regardless of what cell is highlighted. is that possible?
 
Upvote 0
Is it ALWAYS B2, or does this vary? We can hard code it into B2, or we can make its location depend on something else, such as the actively selected cell or in reference to some other cell, etc...

If you always want it to be B2, then change "ActiveCell.Value = Date" to:

Code:
Range("B2").Value = Date
 
Upvote 0
No it won't always be B2. Each date will need to be recorded individually so the dates will need to descend the column. So column A will consist of a header in Cell A1 for the item to be checked and beneath that will be a descending number of buttons with each row representing a daily check of that item.

I will need to check multiply items so is will roughly appear as A2 = Item, B2 = check date, C2 = next item, D2 checked date and so on so forth.

Sorry for any confusion but as I said I'm a complete novice to this!!

Is it ALWAYS B2, or does this vary? We can hard code it into B2, or we can make its location depend on something else, such as the actively selected cell or in reference to some other cell, etc...

If you always want it to be B2, then change "ActiveCell.Value = Date" to:

Code:
Range("B2").Value = Date
 
Upvote 0
So are you just needing to have multiple buttons, each which control adding the date to a specific cell (b2, d2, f2, etc...)?

If so, just follow Mike's suggestion to create the button and then put in the code I suggested and modify the cell address based on the required action of that specific button.
 
Upvote 0

Forum statistics

Threads
1,215,764
Messages
6,126,750
Members
449,335
Latest member
Tanne

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