ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Limits on Userform textbox (https://www.excelbanter.com/excel-programming/298304-limits-userform-textbox.html)

radarguy

Limits on Userform textbox
 
Hi Guys,
I am somewhat new to advanced VBA but trying real hard. One concep
that is the hardest for me to understand and rectify is error trapping
I am trying to make a Userform to change a Spreadsheet cell an
display the change in a "textbox" that I can also just type in
number. The code I have come up with from Excel help is below. I
works ok until I try to edit the textbox with a number greater than th
limit of the scrollbar. Can anyone help me? Also, If anyone can giv
me a simplified explanation of what exactly the three scrollba
commands are doing that would be great!

I've attached the file for easy editing.

Thanks,
Russ

Public Azimuth As Integer

Private Sub cmdContinue_Click()
Unload Me
End Sub

Private Sub txtAzimuth_Change()
scrAzimuth.Value = txtAzimuth.Value
End Sub

Private Sub UserForm_Initialize()
scrAzimuth.Min = 0
scrAzimuth.Max = 360
scrAzimuth.Value = 180
End Sub

Private Sub scrAzimuth_Change()
txtAzimuth.Value = (scrollsaved + scrAzimuth.Value)
Range("b2") = txtAzimuth.Value
End Sub

Private Sub scrAzimuth_Exit(ByVal Cancel As MSForms.ReturnBoolean)
txtAzimuth.Value = (scrollsaved + scrAzimuth.Value)
scrollsaved = scrAzimuth.Value
End Sub

Private Sub scrAzimuth_Scroll()
txtAzimuth.Value = (scrollsaved + scrAzimuth.Value)
End Su

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


Bob Phillips[_6_]

Limits on Userform textbox
 
This seems to be an example whereby the scrollbar is used to set the textbox
value. Slide it up or down and the textbox changes.

It seems totally unnecessary for your app, get rid of it and the three
events.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"radarguy " wrote in message
...
Hi Guys,
I am somewhat new to advanced VBA but trying real hard. One concept
that is the hardest for me to understand and rectify is error trapping.
I am trying to make a Userform to change a Spreadsheet cell and
display the change in a "textbox" that I can also just type in a
number. The code I have come up with from Excel help is below. It
works ok until I try to edit the textbox with a number greater than the
limit of the scrollbar. Can anyone help me? Also, If anyone can give
me a simplified explanation of what exactly the three scrollbar
commands are doing that would be great!

I've attached the file for easy editing.

Thanks,
Russ

Public Azimuth As Integer

Private Sub cmdContinue_Click()
Unload Me
End Sub

Private Sub txtAzimuth_Change()
scrAzimuth.Value = txtAzimuth.Value
End Sub

Private Sub UserForm_Initialize()
scrAzimuth.Min = 0
scrAzimuth.Max = 360
scrAzimuth.Value = 180
End Sub

Private Sub scrAzimuth_Change()
txtAzimuth.Value = (scrollsaved + scrAzimuth.Value)
Range("b2") = txtAzimuth.Value
End Sub

Private Sub scrAzimuth_Exit(ByVal Cancel As MSForms.ReturnBoolean)
txtAzimuth.Value = (scrollsaved + scrAzimuth.Value)
scrollsaved = scrAzimuth.Value
End Sub

Private Sub scrAzimuth_Scroll()
txtAzimuth.Value = (scrollsaved + scrAzimuth.Value)
End Sub


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





All times are GMT +1. The time now is 12:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com