I have a user form with 5 textboxes linked to cells. I can't seem to get the
textboxes to show the entry in Military time. It keeps changing to decimal.
The time shows up correctly in the cell.
any help would be greatly appreciated.
Christy
I have a user form with 5 textboxes linked to cells. I can't seem to get the
textboxes to show the entry in Military time. It keeps changing to decimal.
The time shows up correctly in the cell.
any help would be greatly appreciated.
Christy
Try something like:
Private Sub UserForm_Initialize()
Dim ws As Worksheet
Set ws = ActiveSheet
TextBox1.Text = Format$(ws.Range("A1"), "H:mm")
Set ws = Nothing
End Sub
Note: the capital 'H' in the format string is important. If you use a
lowercase 'h' then you'll get a 12-hour clock value.
Thanks Nick, I will try that!
Christy
"Nick Hebb" wrote:
> Try something like:
>
> Private Sub UserForm_Initialize()
>
> Dim ws As Worksheet
> Set ws = ActiveSheet
>
> TextBox1.Text = Format$(ws.Range("A1"), "H:mm")
>
> Set ws = Nothing
>
> End Sub
>
> Note: the capital 'H' in the format string is important. If you use a
> lowercase 'h' then you'll get a 12-hour clock value.
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks