Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check form input

Status
Not open for further replies.

cmonthetic

IS-IT--Management
Oct 18, 2004
27
GB
Hi,

Using Excel 97.

Using the following code for a user form and for the buttons on the form.

Private Sub CancelB_Click()

unload Me

End Sub

Private Sub ClearB_Click()

Call UserForm_Initialize

End Sub
Private Sub OKB_Click()
ActiveWorkbook.Sheets("SectionB").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If

Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = SerialNoB.Value
ActiveCell.Offset(0, 2) = DateB.Value
ActiveCell.Offset(0, 3) = DescriptionB.Value
ActiveCell.Offset(0, 4) = RequestedByB.Value
ActiveCell.Offset(0, 5) = SupplierB.Value
ActiveCell.Offset(0, 6) = InvoiceNoB.Value
ActiveCell.Offset(0, 7) = NetB.Value
ActiveCell.Offset(0, 8) = VatB.Value
ActiveCell.Offset(0, 10) = DateGoodsReceivedB.Value
ActiveCell.Offset(0, 11) = NotesB.Value
Label12.Caption = Range("B100").Text
Range("A1").Select

End Sub

Private Sub UserForm_Initialize()
Label12.Caption = Range("B100").Text
SerialNoB.Value = ""
DateB.Value = ""
DescriptionB.Value = ""
RequestedByB.Value = ""
SupplierB.Value = ""
InvoiceNoB.Value = ""
NetB.Value = ""
VatB.Value = ""
DateGoodsReceivedB.Value = ""
NotesB.Value = ""
SerialNoB.SetFocus

End Sub

I need to get a message displayed when the value entered in the form for NetB.Value exceeds a previously value that is entered in Cell A2000 in the SectionB worksheet.

I have tried putting another If statement in to the OKB_Click code to generate the message that the value is over the allowed limit but it is not working correctly - it always displays the message box regardless of the result from the if statement.

This is probably a reasonably simple task to accomplish but I am making a mess of it :(

TIA


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top