![]() |
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 |
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/ |
Userform-allow numerical input?
That course in C++ must have slipped my mind. Thanks
-- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 05:22 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com