Userform TextBox Equal To Now

benntw

Board Regular
Joined
Feb 17, 2014
Messages
222
Office Version
  1. 365
Platform
  1. Windows
I have a userform with a checkbox and textbox. What I wanted to do is check the box to complete the record for an update. When I check it the NOW() function is setting my time to 12:00AM. What am I doing wrong in my code ?

Private Sub CheckBox1_Click()
If UserForm1.CheckBox1.Value = True Then
TextBox6.Value = Now()
Else
TextBox6.Value = ""
End If
End Sub

If I had +(7/24) after NOW the date and time will populate to my sheet. If I do not have that extra it will not update my sheet with the date/time. I am at a loss for it not updating. I have built similar workbooks in the past with an update command. The only difference is the checkbox.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I don't see anything there that updates a sheet - just the contents of your userform textbox. If you're saying that
TextBox6.Value = NOW+(7/24) in that code will cause your sheet to update but
TextBox6.Value = NOW will not, then that makes no sense to me.
 
Upvote 0
I don't see anything there that updates a sheet - just the contents of your userform textbox. If you're saying that
TextBox6.Value = NOW+(7/24) in that code will cause your sheet to update but
TextBox6.Value = NOW will not, then that makes no sense to me.
With NOW() or NOW()+(7/24) the time is incorrect. I keep getting the wrong time. I keep getting 12am
 
Upvote 0
Still not clear where - sheet or userform. If sheet, check your cell formatting.
Sorry, It was the TextBox was not populating the current time. I figured it out.

TextBox6.Value = Format(Now(), "M/DD/YY hh:mm am/pm")

Now when I check the box it populates with the correct time.
 
Upvote 0
Funny - I tried it on a userform and it worked just fine.
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,449
Members
448,966
Latest member
DannyC96

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