Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-20-2013, 09:51 PM
dlowrey dlowrey is offline Help with incrementing Spinbutton value. Windows 7 64bit Help with incrementing Spinbutton value. Office 2010 32bit
Novice
Help with incrementing Spinbutton value.
 
Join Date: Feb 2012
Posts: 29
dlowrey is on a distinguished road
Default Help with incrementing Spinbutton value.

Problem 1: The cell D4 value increases or decreases by 2 when the spinbutton is clicked. The spinbutton is an activex control named "Spindays".

Problem 2: The value will go below 0 (ex. -1), even though the property Min is set to 0.

What did I miss?

Thanks for your help. The code is below.
- DL

Private Sub SpinDays_SpinDown()


With Range("D4")
.Value = Range("D4").Value - 1
End With
End Sub
Private Sub SpinDays_SpinUp()
With Range("D4")
.Value = Range("D4").Value + 1
End With
End Sub
Reply With Quote
  #2  
Old 11-20-2013, 10:37 PM
dlowrey dlowrey is offline Help with incrementing Spinbutton value. Windows 7 64bit Help with incrementing Spinbutton value. Office 2010 32bit
Novice
Help with incrementing Spinbutton value.
 
Join Date: Feb 2012
Posts: 29
dlowrey is on a distinguished road
Default

UPDATE
I worked around this by using a simple form control, instead of the active x control. However, I am still interested in knowing why my code is not working. Your thoughts would be appreciated.

Thanks
Reply With Quote
  #3  
Old 11-23-2013, 11:15 PM
macropod's Avatar
macropod macropod is online now Help with incrementing Spinbutton value. Windows 7 32bit Help with incrementing Spinbutton value. Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I'd have thought you could use something like:
Code:
Private Sub SpinDays_SpinDown()
With Range("D4")
  If .Value = 0 Then Exit Sub
  .Value = .Value - 1
End With
End Sub
 
Private Sub SpinDays_SpinUp()
With Range("D4")
  .Value = .Value + 1
End With
End Sub
PS: When posting code, please use the code tags. They're on the 'Go Advanced' tab.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 11-24-2013, 12:28 PM
dlowrey dlowrey is offline Help with incrementing Spinbutton value. Windows 7 64bit Help with incrementing Spinbutton value. Office 2010 32bit
Novice
Help with incrementing Spinbutton value.
 
Join Date: Feb 2012
Posts: 29
dlowrey is on a distinguished road
Default

Thank you, that will work.
-DL
Reply With Quote
Reply

Tags
activex control, increment value, spinbutton



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with incrementing Spinbutton value. multiply by incrementing by 5s marynomore Excel 2 03-27-2013 05:36 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:46 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft