View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Nick Hebb Nick Hebb is offline
external usenet poster
 
Posts: 162
Default Format a Userform textbox to Military time

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.