MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Mar 25th, 2002, 03:00 AM   #1
Dinictus
Board Regular
 
Join Date: Mar 2002
Posts: 162
Default

Hi, I`ve been working on a userform for a few days now and it is almost finished.

However the finishing touch always takes 50% of the time.....

Now I can`t post the whole file here but perhaps someone will spare me some time and is kind enough to take a look at it?

There are 2 problems with the userform:

1: I want to date to fill to 0000 so 23 becomes 0023 automatically. (I uses all types of functions: Right$("000"& etc) formatting the cell with custom format 0000. Nothing seems to work.

2: If data entered in one of the textboxen is notnumeric an msg appears. Thsi work fine but if you backspace in a textbox to delete any alphanumeric characters you also get the message. I cannot seem to avoid this.

So, I am aware that this will be a major thing to ask from someone but I would be so glad if someone tried to help me out.

If someone is interested, I`ll send you the file.

thnks!
Dinictus.



Dinictus is offline   Reply With Quote
Old Mar 25th, 2002, 04:08 AM   #2
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

Hi

I would say you are using the wrong Event for your needs, try this:


Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsNumeric(TextBox1.Value) Then
MsgBox "No Text Please"
Cancel = True
End If
TextBox1 = Format(TextBox1, "0000")
Sheet1.Range("A65536").End(xlUp).Cells(2, 1) = TextBox1.Value
Sheet1.Range("A65536").End(xlUp).Cells(2, 1).NumberFormat = "0000"
End Sub
Dave Hawley is offline   Reply With Quote
Old Mar 25th, 2002, 04:13 AM   #3
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Hey Din. WHat's Up!

I don't know the best way perhaps but this will give you the 00's you need



1: I want to date to fill to 0000 so 23 becomes 0023 automatically. (I uses all types of functions: Right$("000"& etc) formatting the cell with custom format 0000. Nothing seems to work.



Assign the Day Number to a variable for this:
txtDinsText.text = Format(DayNumber, "0000")

Or just fiddle with the date this way
txtDinsText.text = Format(day(yourdate), "0000")




2: If data entered in one of the textboxen is notnumeric an msg appears. Thsi work fine but if you backspace in a textbox to delete any alphanumeric characters you also get the message. I cannot seem to avoid this.

Use the exit event instead of the change event for the texbox(es)

Tom


[ This Message was edited by: TsTom on 2002-03-25 03:15 ]
Tom Schreiner is offline   Reply With Quote
Old Mar 25th, 2002, 04:15 AM   #4
Dinictus
Board Regular
 
Join Date: Mar 2002
Posts: 162
Default

Thanks guys.

I`m going to try to implement some of your syntax.


[ This Message was edited by: Dinictus on 2002-03-25 03:18 ]

[ This Message was edited by: Dinictus on 2002-03-25 07:11 ]
Dinictus is offline   Reply With Quote
Old Mar 25th, 2002, 04:17 AM   #5
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

Go ahead and post your code so we can see what's up???

Mail it to me if ya want.

[ This Message was edited by: TsTom on 2002-03-25 03:18 ]
Tom Schreiner is offline   Reply With Quote
Old Mar 25th, 2002, 04:20 AM   #6
Dinictus
Board Regular
 
Join Date: Mar 2002
Posts: 162
Default

Allright: here it is:

KABOOOM>


Private Sub TBpanel_Change()
Worksheets("sheet1").Range("A2").Value = TBpanel
If Not IsNumeric(TBpanel.Value) Then
MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
End If
End Sub

Private Sub TBL1_Change()
Worksheets("sheet1").Range("B2").Value = TBL1
If Not IsNumeric(TBL1.Value) Then
MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
End If
End Sub

Private Sub TBL1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
L = Len(TBL1.Value)
If L < 4 Then
TBL1.Value = Application.Rept("0", 4 - L) & TBL1.Value
End If
End Sub

**********
Above:
My attempt to format to "0000" it works but if you tab out of this taxt box, somehow it skips 2 tabs not 1
**********


Private Sub TBL2_Change()
Worksheets("sheet1").Range("C2").Value = TBL2
If Not IsNumeric(TBL2.Value) Then
MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
End If
End Sub


Private Sub TBL3_Change()
Worksheets("sheet1").Range("D2").Value = TBL3
If Not IsNumeric(TBL3.Value) Then
MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
End If
End Sub

Private Sub TBL4_Change()
Worksheets("sheet1").Range("E2").Value = TBL4
If Not IsNumeric(TBL4.Value) Then
MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
End If
End Sub

Private Sub TBL5_Change()
Worksheets("sheet1").Range("F2").Value = TBL5
If Not IsNumeric(TBL5.Value) Then
MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
End If
End Sub

Private Sub TBDL1_Change()
Worksheets("sheet1").Range("G2").Value = TBDL1
If Not IsNumeric(TBDL1.Value) Then
MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
End If
End Sub

Private Sub TBDL2_Change()
Worksheets("sheet1").Range("H2").Value = TBDL2
If Not IsNumeric(TBDL2.Value) Then
MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
End If
End Sub

Private Sub TBDL3_Change()
Worksheets("sheet1").Range("I2").Value = TBDL3
If Not IsNumeric(TBDL3.Value) Then
MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
End If
End Sub

Private Sub TBDL4_Change()
Worksheets("sheet1").Range("J2").Value = TBDL4
If Not IsNumeric(TBDL4.Value) Then
MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
End If
End Sub

Private Sub TBDL5_Change()
Worksheets("sheet1").Range("K2").Value = TBDL5
If Not IsNumeric(TBDL5.Value) Then
MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry"
End If
End Sub


Private Sub CommandButton1_Click()
Unload Me
Rows("2:2").EntireRow.AutoFit
Rows("2:2").Insert Shift:=xlDownward
Range("A2").Select
UserForm1.Show
End Sub

Private Sub CommandButton2_Click()
MsgBox "Om de gegevens handmatig aan te passen kunt u de knop 'SHEET HANDMATIG AANPASSEN' gebruiken." & Chr(13) & "Om hierna weer terug te gaan naar het invoerscherm kunt u gebruik maken van de knop 'INVOERFORMULIER'." & Chr(13) & Chr(13) & "Nadat alle gegevens ingevoerd zijn, kunt u de informatie kopiëren en opslaan in een andere sheet.", vbInformation
End Sub

Private Sub CommandButton3_Click()
Unload Me
End Sub


Private Sub UserForm_Click()

End Sub
Dinictus is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 12:57 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes