+ Reply to Thread
Results 1 to 5 of 5

Spin Button variable linked cell

  1. #1
    Registered User
    Join Date
    08-05-2012
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    8

    Spin Button variable linked cell

    Hi, I'm trying to figure out how to make a spin button adjust it's linked cell based off a value in another cell. It is basically used to adjust values in a range on another sheet, that I have hidden.

    On that sheet, I have 13 columns, the Col A is the year, the Col B is the month, both columns going down several years, and Col C is a number, starting at 1 on the first date. Columns D - M contain the values I want to be able to adjust. I will have a spin button for each column. On the sheet with the spin buttons are, the user will select month and year in 2 combo boxes, and there is a formula to come up with a number, which is the numbers in Col D, so if the user selects January 2013 the number will be 13. I have this formula in a named range, calling it "DMSel".

    Is there a way to set the Spin Button Linked Cell value to use the range "DMSel" as row number on the data sheet? So if it is indeed January 2013 that is selected, the spin button will change the values in cell E13? But if the user selects February 2012, the spin button will change values in cell E2? This is if the user is using the spin button for Column E. Thank you for any help. Following is a quick example of how the data sheet is set up. 2012 on the top left is cell A1.


    2012 January 1
    2012 February 2
    ...
    ...
    2012 December 12
    2013 January 13
    2013 February 14
    Last edited by Ozzmatron; 10-18-2013 at 10:05 AM.

  2. #2
    Registered User
    Join Date
    10-17-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Spin Button variable linked cell

    Hi Ozz,

    What value are you trying to change? The spin button will just add or subtract 1 to the linked cell. If 2012 February is supposed to be 2 why not just set E2 equal to 2 (which would be the value of the linked cell)?

    Maybe, I'm just not understanding what you are trying to accomplish...

  3. #3
    Registered User
    Join Date
    08-05-2012
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Spin Button variable linked cell

    I'll try to explain a little better. The section of the main sheet where the spin buttons are has 10 cells that each have a value. The user can select those values and adjust them with the spin buttons, one for each cell. I have it set at 5, but have code to change them all to either 5, 10, 20, 50, or 100. Each of these cells shows the value for a certain month and year. In the data sheet I have, i have the months listed with the years, it starts at january 2012, and goes to the current month, and adds one month at the beginning of each month. Each cell has a vlookup to go to a certain cell on the data sheet, corresponding to the month and year that the user has selected.
    The spin buttons change the values in the data sheet, which the cells on the main sheet just reference. What I want to do is when the month and or year is changed, to have the spin buttons linked cell move up or down rows, to correspond to the date selected. Say, if January 2012 is selected, spin button 1 would be linked to cell D1 on the data sheet, but if the user changes to February 2012, spin button 1 would be linked to cell D2; all the way to the end, so say if October 2013 is selected, spin button 1 would link to cell D12.
    I have a formula that displays a number which is equal to the number of months since the start, and would like to use that as a reference for the row in the linked cell property, but can't figure out how to do it.

  4. #4
    Registered User
    Join Date
    08-10-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Spin Button variable linked cell

    Here, why don't you upload your file at www.excelVBAmaster.com I'll do it for free for you. Just put in $0.01 per hour. I won't charge you.

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Spin Button variable linked cell

    You can do this with names
    Define a name
    Name: myCell RefersTo: =INDEX(Sheet1!$1:$1, 1, Sheet1!$A$2)

    Then set the cell link of the spin button to =myCell

    If A2 is 1, the spin button will be linked to A1
    If A2 is 2, it will be linked to B1
    If A2 is 3, it will be linked to C1
    etc.
    Last edited by mikerickson; 10-18-2013 at 11:32 PM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

+ 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. Spin Buttons - Linked Cell to update when copied?
    By svpdebbie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-14-2017, 09:18 AM
  2. Macro based on Spin Button Linked cell value
    By turist in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-20-2013, 11:57 AM
  3. [SOLVED] Macro based on Spin Button Linked cell value
    By turist in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-15-2013, 04:07 PM
  4. How to make the spin button's linked cell vary
    By Irascivel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-31-2009, 06:39 PM
  5. Spin Button:spin cells A7
    By ice in forum Excel General
    Replies: 1
    Last Post: 03-16-2007, 02:23 PM

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