Closed Thread
Results 1 to 6 of 6

Refer to named SpinButton in VBA

  1. #1
    Registered User
    Join Date
    07-15-2011
    Location
    Edmonton, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Refer to named SpinButton in VBA

    I have a SpinButton in my Excel worksheet (not on a form), that I have named "spinMonth". I have assigned a VBA macro called "spinMonthClick" to the SpinButton. In the macro I want to refer to the Value property of the SpinButton. How do I do that? I can refer to the SpinButton as a Shape using ActiveSheet.Shapes("spinMonth"), but this doesn't give me access to the Value property.

    Thanks in advance.
    Last edited by mjj300; 07-15-2011 at 04:42 PM.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Refer to named SpinButton in VBA

    Either:

    Please Login or Register  to view this content.

    Or
    Please Login or Register  to view this content.
    Dependent of the kind of spinbutton (formcontrol or ActiveX)



  3. #3
    Registered User
    Join Date
    05-09-2013
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Refer to named SpinButton in VBA

    Snb,

    I found your reply after a search of how to reference spinbuttons in VBA, but your suggestion is not working in my case. I have an ActiveX Spinbutton in Excel 2010, and this code in a module (not in the sheet where the spinbutton is located)

    Please Login or Register  to view this content.
    Executing this returns an "Object doesn't support this property or method" error.

    Is there another way to change the max value of a spinbutton?

    thanks

  4. #4
    Registered User
    Join Date
    03-12-2014
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: Refer to named SpinButton in VBA

    Try to go in Design mode, right click on the spin button and select properties you can manually change it's Min/Max - Unless it's macro based and you'd like it to be different everytime?

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Refer to named SpinButton in VBA

    tmallin,
    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.
    Ben Van Johnson

  6. #6
    Registered User
    Join Date
    05-09-2013
    Location
    Michigan, USA
    MS-Off Ver
    Excel 2010
    Posts
    43

    Re: Refer to named SpinButton in VBA

    OK, I'll post a new one. Just thought I'd try to cut down on the number of posts. thnx

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1