time and date stamp in VBA form

ddewitt

New Member
Joined
Jan 31, 2020
Messages
3
Office Version
  1. 2010
Platform
  1. Windows
Currently new to using VBA and im looking to make a code for the time and date stamp that is automatically updated to the current day and time. Basically automatically being shown then when you hit save on the document, it captures that and sends it with the other information into a spreadsheet
 

Attachments

  • form.png
    form.png
    7.1 KB · Views: 16

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Not sure what Hit Save means.
But here is a script to enter Current Date and time in UserForm TextBox1.
Change formatting how you want.
VBA Code:
Private Sub CommandButton1_Click()
'Modified  2/1/2020  2:05:17 AM  EST
TextBox1.Value = Format(Now(), "mmm/dd/yy HH:MM:SS")
End Sub
 
Upvote 0
For more clarification, i'm trying to have a text box that is has the time running in realtime. When i finish entering the information from the various drop down menu selections I've created on the form; i hit save which will save all the information i entered into an excel file with the time at which i hit the save button. This may work though, i just have to figure out how to make everything i enter transfer to an excel file and wipe the info from the form when i hit the save button. Thank you for your input, i'm new to doing this
 

Attachments

  • Untitled.png
    Untitled.png
    35.6 KB · Views: 10
Upvote 0
I'm not sure if your saying you still need more help or have solved the question yourself.

I know of no way how you can have a Textbox which has the real time instantly displaying at all times.
Now we can write a script that when run will enter the current time and date someplace.
You said:
i just have to figure out how to make everything i enter transfer to an excel file and wipe the info from the form when i hit the save button. Thank you for your input, i'm new to doing this

We would need a lot more specific details to accomplish this.

You would need a button on your form which would have a script sort of like this:

Sheets("Master").Range("G15").value=Textbox1.value

And the script could put the current date and time someplace and tell the script to then do a Save.
 
Upvote 0
I think i figured out something to get where i'm going thanks for your help!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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