+ Reply to Thread
Results 1 to 5 of 5

Dynamic updating of linked ControlSource cells

  1. #1
    Registered User
    Join Date
    06-28-2011
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2010, 2013, 2016, 365
    Posts
    79

    Dynamic updating of linked ControlSource cells

    Hi All,

    I have a problem. I have a UserForm with tickboxes, each of which is linked to a unique cell via the ControlSource property. The value of each respective cell (TRUE/FALSE) then dictates how data are displayed in a variety of charts.

    The problem is that when I click a tickbox the charts are always out of step. For instance, if I check the date '2009/10', the data for this year do not appear on the charts until I tick another box (the data for which are not displayed until I check a third box, and so on).

    I can include the following code for each tickbox routine, which solves the problem.

    Please Login or Register  to view this content.
    Rather than include the first two lines for each tickbox routine (there are 30) I want to write a macro that will dynamically update the cell cited in the ControlSource property with the value of whichever tickbox is active. I was thinking something akin to the following but I do not know how to correctly write the VBA syntax (apologies as the following is a mishmash of VBA and Excel formulae).

    Please Login or Register  to view this content.
    Can anyone help me with the correct way to do this?

    Many thanks,
    Ad

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

    Re: Dynamic updating of linked ControlSource cells

    Do you mean optionbuttons when mentioning 'tickboxes' ?

    There's no need to use controlsource; you can refer to the optionbutton value itself.



  3. #3
    Registered User
    Join Date
    06-28-2011
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2010, 2013, 2016, 365
    Posts
    79

    Re: Dynamic updating of linked ControlSource cells

    Quote Originally Posted by snb View Post
    Do you mean optionbuttons when mentioning 'tickboxes' ?

    There's no need to use controlsource; you can refer to the optionbutton value itself.
    Well, I have OptionButtons and CheckBoxes in my UserForm... Are you saying that I can refer to these objects directly in my Excel formulae?

    Thx
    AdLoki

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

    Re: Dynamic updating of linked ControlSource cells

    Only if you let VBA produce your charts (and why would'nt you if you are using a userform ?)

  5. #5
    Registered User
    Join Date
    06-28-2011
    Location
    Bristol, UK
    MS-Off Ver
    Excel 2010, 2013, 2016, 365
    Posts
    79

    Re: Dynamic updating of linked ControlSource cells

    Quote Originally Posted by snb View Post
    Only if you let VBA produce your charts (and why would'nt you if you are using a userform ?)
    Unfortunately i only started working with VBA last week and I don't really have the time to learn how to code charts right now. If you know of any good online guidance or tutorials for doing so, I'd be inetrested to look into it at a later date but, right now, I need to finalise this project... I guess I'll just have to put the code in my OP into each routine separately, I just thought there would be a more elegant, dynamic way of referencing it.

    Many thanks for your input.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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