Macro to get time stamp in a cell next to it

sturnusek

Board Regular
Joined
Sep 20, 2018
Messages
51
Hi,

I have been trying for a while now, but I can't seem to be able to get over this.

I'm looking for a macro/formula, which will be based on a Check box to return time. Once it's ticked, I want the time of the tick to be placed in a cell next to it.

Any ideas?

Thanks
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
.
Code:
Option Explicit


Private Sub CheckBox1_Click()
    If CheckBox1.Value = True Then
        Me.Range("C3").Value = Time
    Else
        Me.Range("C3").Value = ""
    End If
End Sub
 
Upvote 0
Thank you for your reply and your time.

I tried to use the code provided, but everytime it's assigned to a Checkbox and clicked, VBA returns compile error. Any idea? Thank you :)
 
Upvote 0
.
Make certain your checkbox is named Checkbox1 .. or .. change the name of the checkbox in the macro code to match the name of your
actual checkbox.

Secondly, do not use a UserForm checkbox. Use an ActiveX checkbox.
 
Upvote 0
Logit,

I have tried everything that you listed and still had no joy. I recently updated to Office 365 and just noticed that most of my formulas are not functioning properly, could that be the case?

Thanks
 
Upvote 0
I have managed to do it now, all I had to do is to change the value from Time to NOW()

I have a question though, is there anyway to edit this code so it's going to be a bit more flexible? I want to have over 5000 tick boxes in each row and it'd be time consuming to correct the codes in all of them. Could it be working like on a code you did for me previously, where a time is being generated below of the one that is already entered?

Thanks
 
Upvote 0
I can never see any reason why someone would need 5000 checkbox's in their sheet.
If you want the current time entered in column A when you click a checkbox.

Why not double click on the cell in column 1 and the time can be entered with no need for checkboxes.

This type script would have about four lines of code that would work on all 5000 rows or more.

Would not something like this work.
 
Upvote 0

Forum statistics

Threads
1,214,518
Messages
6,119,985
Members
448,935
Latest member
ijat

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