Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Userform-allow numerical input?

I have the following userform which I copied and modified from thi
website's userform tutorial. It has worked fine as a source o
numerical input. However I now need it allow numbers beyond 50,000.
believe Excel places a limit of around 39K on numbers entered as a tex
value. Any suggestions on how I may correct this? I assume I need
"number box" rather than a text box but I do not know if such an ite
exists.

Thanks!

Private Sub cmdOK_Click()
'
'Accepts information in UserForm
' adjusts the data for beginning and end
' based on user-entered data
'
Dim j As Integer
j = txtPhone.Value
Dim i As Integer
Dim numrow As Integer
numrow = 0
Dim numcol As Integer
numcol = 0
Dim nmrow As Integer
nmrow = 0
Dim SOME As Double
SOME = 0

ActiveWorkbook.Activate
ActiveCell.Offset(0, 1).Select

Range(Selection, Selection.End(xlDown)).Select
Selection.Insert Shift:=xlToRight
Selection.End(xlUp).Select

ActiveCell = "Sum"
ActiveCell.Select

ActiveCell.Offset(1, -1).Select
Do While Not (IsEmpty(ActiveCell))
If (ActiveCell < j) Then
ActiveCell = 0
Else
End If
ActiveCell.Offset(1, 0).Select
Loop

Selection.End(xlUp).Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
Do While Not (ActiveCell < 0) And Not (IsEmpty(ActiveCell))
ActiveCell.Offset(1, 0).Select

If (ActiveCell < 0) Then
Do While (ActiveCell < 0)
SOME = ActiveCell.Value + SOME
ActiveCell.Offset(1, 0).Select
Loop

ActiveCell.Offset(-1, 1).Select
ActiveCell = SOME
ActiveCell.Offset(1, -1).Select
Else
End If
SOME = 0
Loop

Selection.End(xlUp).Select
Selection.End(xlUp).Select
Unload Me
End Sub

Private Sub UserForm_Initialize()
'
'Sets Phone.Value as empty before displaying UserForm
'
txtPhone.Value = ""
optIntroduction = True
txtPhone.SetFocus
End Su

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Userform-allow numerical input?

Change Integer to Long in all places.

--
Regards,
Tom Ogilvy

"waveracerr " wrote in message
...
I have the following userform which I copied and modified from this
website's userform tutorial. It has worked fine as a source of
numerical input. However I now need it allow numbers beyond 50,000. I
believe Excel places a limit of around 39K on numbers entered as a text
value. Any suggestions on how I may correct this? I assume I need a
"number box" rather than a text box but I do not know if such an item
exists.

Thanks!

Private Sub cmdOK_Click()
'
'Accepts information in UserForm
' adjusts the data for beginning and end
' based on user-entered data
'
Dim j As Integer
j = txtPhone.Value
Dim i As Integer
Dim numrow As Integer
numrow = 0
Dim numcol As Integer
numcol = 0
Dim nmrow As Integer
nmrow = 0
Dim SOME As Double
SOME = 0

ActiveWorkbook.Activate
ActiveCell.Offset(0, 1).Select

Range(Selection, Selection.End(xlDown)).Select
Selection.Insert Shift:=xlToRight
Selection.End(xlUp).Select

ActiveCell = "Sum"
ActiveCell.Select

ActiveCell.Offset(1, -1).Select
Do While Not (IsEmpty(ActiveCell))
If (ActiveCell < j) Then
ActiveCell = 0
Else
End If
ActiveCell.Offset(1, 0).Select
Loop

Selection.End(xlUp).Select
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Select
Do While Not (ActiveCell < 0) And Not (IsEmpty(ActiveCell))
ActiveCell.Offset(1, 0).Select

If (ActiveCell < 0) Then
Do While (ActiveCell < 0)
SOME = ActiveCell.Value + SOME
ActiveCell.Offset(1, 0).Select
Loop

ActiveCell.Offset(-1, 1).Select
ActiveCell = SOME
ActiveCell.Offset(1, -1).Select
Else
End If
SOME = 0
Loop

Selection.End(xlUp).Select
Selection.End(xlUp).Select
Unload Me
End Sub

Private Sub UserForm_Initialize()
'
'Sets Phone.Value as empty before displaying UserForm
'
txtPhone.Value = ""
optIntroduction = True
txtPhone.SetFocus
End Sub


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Userform-allow numerical input?

That course in C++ must have slipped my mind. Thanks

--
Message posted from http://www.ExcelForum.com

Reply
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, with no input pgarcia Excel Discussion (Misc queries) 0 September 14th 07 05:02 PM
Formatiing a input Box in a Userform Jeff Excel Discussion (Misc queries) 0 April 13th 06 08:57 PM
Wrong Numerical Input zhj23 Excel Discussion (Misc queries) 3 February 12th 06 03:19 AM
Numerical Input via an inputbox method Tom Ogilvy Excel Programming 0 August 16th 04 07:33 PM
Numerical Input via an inputbox method Bob Phillips[_6_] Excel Programming 0 August 16th 04 07:30 PM


All times are GMT +1. The time now is 06:37 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"