+ Reply to Thread
Results 1 to 4 of 4

Data Validation with Scroll Bar

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-29-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    103

    Data Validation with Scroll Bar

    Using Excel 2003. Windows 7.

    My Problem:

    On my sheet, I have a cell that the user can increment with a scroll bar by 1-point at a time up or down, minimum of 0, maximum of 99, starts at 1. The scroll bar outputs to, lets say cell B1. Cell C1 has a dynamic number that cannot be exceeded. B1 has Data Validation that says that cell cannot be greater than cell C1, nor less than 0.

    When the user types in the number in cell B1 manually, Data Validation works dandy, giving an error message if the number is greater than cell C1, however when the user uses the scroll bar to increment the number, data validation fails to give the error message.

    I've spent about 1-hour on google trying to find an answer to this, but for some really strange reason, I seem to be the only person in the world to have discovered this problem... So unless there is a way to alter the way the scroll bar works, I'm pretty sure I have to do this with VBA.

    BTW, I might be using a spinner instead of a scroll bar, but am having difficulty figuring out which one it is just by looking at it, and right-clicking it does not tell me what it is, nor does pressing F5 on it (oh how I miss my Visual Studio at times like this).

    EDIT: Derp, it's a spinner. I opened it to edit its macro and it's called Spinner286. So I have 30 spinner's and plan on using this code with each one, problem is, I'm not sure how to address the spinner with the "With" command, i.e. do I call it SpinButton286, or Spinner286?

    Sub Spinner286_Change()
    With SpinButton1
    If .Value > [c1] Then .Value = [c1]
    End With
    End Sub
    Last edited by Taemex; 08-08-2013 at 01:03 AM.

  2. #2
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Data Validation with Scroll Bar

    Best guess: The scroll bar is a control, the manipulation of which would likely need to be monitored (B1 as Target) via a worksheet_change event. Googleing worksheet_change events should give you enough to read through Christmas.

    Cheers

    Edit: Posted after OP edited. Likely of little use.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  3. #3
    Forum Contributor
    Join Date
    08-29-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    103

    Re: Data Validation with Scroll Bar

    Thanks for the reply. I just edited my response after finding out something. I think for the most part I figured it out but need a little more help nailing it before marking this resolved.

    EDIT: alright I changed it to this:

    Sub Spinner286_Change()
    With Spinner286
    If .Value > [aw210] Then .Value = [aw210] 'Error messege here, from IF to THEN...
    End With
    End Sub
    But I get a debug error at the IF statement. No ideas why.

    Just tried it multiple ways. Even if I put a solid number in, or add Spinner286 to value I get the error, i.e.:

    If Spinner286.Value > 3 Then .Value = [aw210]
    Last edited by Taemex; 08-08-2013 at 01:17 AM.

  4. #4
    Forum Contributor
    Join Date
    08-29-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    103

    Re: Data Validation with Scroll Bar

    Wow.... alright, I had to add a space between Spinner and 286...., but it would not work with WITH, so I had to competly alter my code as thus if anyone is interested:

    Dim oSpinner As Shape
    
    Set oSpinner = ActiveSheet.Shapes("Spinner 286")
    
    oSpinner.ControlFormat.Max = [aw210]
    oSpinner.ControlFormat.Min = 0

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 03-19-2013, 04:39 PM
  2. [SOLVED] Auto scroll down data validation list
    By [email protected] in forum Excel General
    Replies: 6
    Last Post: 09-20-2012, 11:25 AM
  3. Data Validation Scroll Bar
    By zplugger in forum Excel General
    Replies: 6
    Last Post: 12-01-2011, 04:36 PM
  4. scroll bar usage with data validation
    By maacmaac in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-30-2008, 12:03 AM
  5. Data Validation - Scroll in the formula bar for a custom criteria
    By Hanno Scholtz in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-22-2005, 10:05 AM

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