FryGirl
Well-known Member
- Joined
- Nov 11, 2008
- Messages
- 1,368
- Office Version
- 365
- 2016
- Platform
- Windows
I have two question relating to a userform.
First, if the user enters values in textbox1 and textbox2, but does not enter anything in textbox4 how can I prevent the error that bascially says textbox4 is empty. Same thing for textbox1 and/or textbox2 are empty yet textbox4 contains a value.
So in the end both textbox1 and textbox2 need to be filled out before they can process a result in Textbox3.
Also, I thought the [hh]:mm would allow the processing of time over 24 hours like it will in spreadsheet cell, but it doesn't seem to be cooperating.
First, if the user enters values in textbox1 and textbox2, but does not enter anything in textbox4 how can I prevent the error that bascially says textbox4 is empty. Same thing for textbox1 and/or textbox2 are empty yet textbox4 contains a value.
So in the end both textbox1 and textbox2 need to be filled out before they can process a result in Textbox3.
Also, I thought the [hh]:mm would allow the processing of time over 24 hours like it will in spreadsheet cell, but it doesn't seem to be cooperating.
Code:
Private Sub CommandButton1_Click()
TextBox3.Value = Format(TextBox1.Value / TextBox2.Value, "0.00")
TextBox5.Value = Format(TextBox4 / 1440, "[hh]:mm")
End Sub