Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have a userform where the user enters the percentage complete of various items. I have a problem dealing with both of the following; 1) When activated, the userform extracts the previous "percent complete" from the spreadsheet. If the user tabs over the previous number (doesn't change the value) i get a zero or error message. 2) Because the number entered by the user is divided by 100, if the "percent complete" is zero, i get a error (but i need the program to accept zeros as an imput). I'm currently using the following code for transferring the userform inputs into the spreadsheet. Range("PrelimDes").Value = Format((txtPrelimDesComplete.Value / 100), "#0%") What code could i use to alleviate my problems? Also, I havent defined my userform variables. What is an appropriate dim for "percentage" values in userform textboxes? Thanks for your help Troy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try:
If IsNumeric(TextBox1) Then Range("A1").NumberFormat = "#0%" Range("A1").Value = TextBox1 / 100 End If -- Vasant "TroyB" wrote in message u... Hi, I have a userform where the user enters the percentage complete of various items. I have a problem dealing with both of the following; 1) When activated, the userform extracts the previous "percent complete" from the spreadsheet. If the user tabs over the previous number (doesn't change the value) i get a zero or error message. 2) Because the number entered by the user is divided by 100, if the "percent complete" is zero, i get a error (but i need the program to accept zeros as an imput). I'm currently using the following code for transferring the userform inputs into the spreadsheet. Range("PrelimDes").Value = Format((txtPrelimDesComplete.Value / 100), "#0%") What code could i use to alleviate my problems? Also, I havent defined my userform variables. What is an appropriate dim for "percentage" values in userform textboxes? Thanks for your help Troy |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you Vasant. The code works great.
These newsgroups are excellent! Regards, Troy "Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ... Try: If IsNumeric(TextBox1) Then Range("A1").NumberFormat = "#0%" Range("A1").Value = TextBox1 / 100 End If -- Vasant "TroyB" wrote in message u... Hi, I have a userform where the user enters the percentage complete of various items. I have a problem dealing with both of the following; 1) When activated, the userform extracts the previous "percent complete" from the spreadsheet. If the user tabs over the previous number (doesn't change the value) i get a zero or error message. 2) Because the number entered by the user is divided by 100, if the "percent complete" is zero, i get a error (but i need the program to accept zeros as an imput). I'm currently using the following code for transferring the userform inputs into the spreadsheet. Range("PrelimDes").Value = Format((txtPrelimDesComplete.Value / 100), "#0%") What code could i use to alleviate my problems? Also, I havent defined my userform variables. What is an appropriate dim for "percentage" values in userform textboxes? Thanks for your help Troy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Making Zeros look like no entry | Excel Discussion (Misc queries) | |||
Data Entry Online, Data Format, Data Conversion and Data EntryServices through Data Entry Outsourcing | Excel Discussion (Misc queries) | |||
automatically prefix cell entry with leading zeros | Excel Worksheet Functions | |||
microsoft excel help dealing with data entry forms....please help | Excel Worksheet Functions | |||
How to program data entry to avoid zeros or last 5 digit. | Excel Discussion (Misc queries) |