Hi there.
I am trying to develop a relatively simple userform where user enters (at the moment) a number code & date ("dd/mm").
I want ensure that the correct data goes in as it links back to a SS that carries out a range of complex calculations in teh worksheet & then displays the update data back to user.
I am having problems making sure that there is data in teh textbox, & that it in box1 it a number between 50 & 20600 & in Box2 that it is a date format of "dd/mm".
I cannot get the messagebox to work despite googling & having 2 VBA books as well!
I also want to make sure that the output boxes(gets data from sheet to display) cannot be changed & sent back to sheet as the data is based on complex formulas.
Hers is what I have -
BTW I am using XL 2000 with VBA(VB)6.
I am trying to develop a relatively simple userform where user enters (at the moment) a number code & date ("dd/mm").
I want ensure that the correct data goes in as it links back to a SS that carries out a range of complex calculations in teh worksheet & then displays the update data back to user.
I am having problems making sure that there is data in teh textbox, & that it in box1 it a number between 50 & 20600 & in Box2 that it is a date format of "dd/mm".
I cannot get the messagebox to work despite googling & having 2 VBA books as well!
I also want to make sure that the output boxes(gets data from sheet to display) cannot be changed & sent back to sheet as the data is based on complex formulas.
Hers is what I have -
Code:
Private Sub btnOK_Click()
'To enter US data & show uodated calculations
Dim USNo As String 'From US # Textbox
Dim DateAchvd As String 'From US date achvd textbox
USNo = txtUSNo.Value
DateAchvd = txtDateAchvd.Value
'Ensure US No is enetred
If Not USNo <> "" And USNo > 56 And USNo < 20600 Then
ResultUS = MsgBox("Please enter valid US Number.", vbOKOnly)
txtUSNo.Value = ""
txtUSNo.SetFocus
'Ensure date "dd/mm" is entered
ElseIf Not txtDateAchvd.Value <> " " Then
ResultDate = MsgBox("Please enter valid Date Format", vbOKOnly)
txtDateAchvd.Value = ""
txtDateAchvd.SetFocus
End If
'Make sure US Prgrss is active
Sheets("US Prgss").Activate
'Find the cell with the US selected
Range("T6:CZ6").Select
Selection.Find(What:=USNo, After:=ActiveCell).Activate
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = DateAchvd
'ActiveCell.Offset(1, 0).Select
'ActiveCell.FormulaR1C1 = DateAchvd
txtUSNo.Value = ""
txtDateAchvd.Value = ""
ActiveCell.Range("C7").Activate
End Sub
BTW I am using XL 2000 with VBA(VB)6.