LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Userform Initialize Problem !


Dear Sir,

I have a Userform for the data entry purpose, when I press the OK
button then records are written on the sheet, and one message is
appearing YES/NO.

if I press Yes, then Userform must be clear all fields. but at the
same time message appearing "Please use numbers only"

infact I put the restriction on the Unit Price field, that should be
numbers only.

then I dont understand why this message is coming when I press OK
button.

any suggession ???


I AM USING THE BELOW CODE
=========================

Private Sub CommandButton3_Click()
' for ok button
ActiveWorkbook.Sheets("DailyPurchase").Activate
Range("A5").Select


' to fill up combo box for the category
If ComboCategory.ListIndex = -1 Then
MsgBox "You must choose the category SHAHZAD"
ComboCategory.SetFocus
Exit Sub
End If

' to fill up Date

If DatePurchase = "" Then
MsgBox "you must provide date"
DatePurchase.SetFocus
Exit Sub
End If

' to fill up QTY

If txtQuantity = "" Then
MsgBox " you must provide Quantity "
txtQuantity.SetFocus
Exit Sub
End If

' to fill up Unit price

If txtUnitPrice = "" Then
MsgBox " you must provide Unit Price "
txtUnitPrice.SetFocus
Exit Sub
End If



Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
ActiveCell.Value = DatePurchase.Value
ActiveCell.Offset(0, 1) = TxtDescription.Value
ActiveCell.Offset(0, 2) = txtQuantity.Value
ActiveCell.Offset(0, 3) = txtUnitPrice.Value
ActiveCell.Offset(0, 5) = ComboCategory.Value
ActiveCell.Offset(0, 6) = txtPR.Value
ActiveCell.Offset(0, 7) = txtRemarks.Value
' Range("A5").Select



' Ask and Do Procedure
If MsgBox("One record is written, do you have more entries ?",
vbYesNo, "Title") = vbYes Then

Call UserForm_Initialize

Else

Unload Me

End If

End Sub






Private Sub UserForm_Initialize()

TxtDescription.Value = ""
DatePurchase.Value = ""
txtUnitPrice.Value = ""
txtQuantity.Value = ""
txtPR.Value = ""
ComboCategory.Value = ""
txtQuantity.Value = ""
txtRemarks.Value = ""
DatePurchase.SetFocus

End Sub


Private Sub txtUnitPrice_change()
If Not IsNumeric(txtUnitPrice.Text) Then
MsgBox "Please use numbers only"
Exit Sub
End If
End Sub

===================================

Please give me the solution, I dont need this message when I press OK
button.

Regards.


Shahzad

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Initialize TotallyConfused Excel Programming 3 December 4th 07 05:57 PM
UserForm Initialize Problem DeathSurfer Excel Programming 4 September 7th 07 05:00 PM
UserForm initialize event run when UserForm is shown [email protected] Excel Programming 2 June 13th 07 02:49 AM
UserForm initialize Arne Hegefors Excel Programming 8 September 8th 06 01:48 PM
initialize userform, using a sub natanz[_2_] Excel Programming 11 November 22nd 05 05:30 AM


All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"