View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Userforms - Dealing with zeros and non-entry of data

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