Printing integers from a userform

B

Brad

I have a userform on an excel workbook that takes numerical input from a user
and should paste those values to another workbook. This works fine; however,
it pastes the numbers as text format instead of number format. How do I get
the values to be number format not text?

Thanks for any help
 
J

JLGWhiz

If, for instance, the value is entered into a textbox1:

Sheets(2).Range("A1") = CInt(UserForm1.Textbox1.Value)
or
Sheets(2).Range("A1") = CLng(UserForm1.Textbox1.Value)

The conversion function CLng gives a larger limit on the number of digits
that Excel will handle without sending an Overflow message.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top