+ Reply to Thread
Results 1 to 6 of 6

Macro for Active X ComboBoxes

  1. #1
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    Macro for Active X ComboBoxes

    Hi Everyone!

    Okay, so I have a dashboard I'm building and I have a lot of combo boxes I have put into it. Alot. After updating 40 manually, I decided I would seek your help.

    I have searched for this online but have not been able to find a working solution.

    I would like help writing a macro that will update the relative reference of the linked cell for each combo box to the cell it is stationed in (each box sits in a merged cell that is two cells wide, 1 row tall). Updating the relative reference for each would be mind-numbingly awful, and extremely inefficient. I have already placed the boxes where I want, I just need to update their linked cell references.

    The listfillrange does not need to change as this is set perfectly for each one already.

    Also, I am applying a percentage format to each combo box (so that their number appears as a percentage instead of a decimal).

    I am using this macro code:

    ComboBox33 = Format(ComboBox33, "0%")

    This works great. But is there a way to apply it to all of my combo boxes at once (I pulled that one at random) so I also do not have to manually copy and paste this into the macro of each combo box?

    I appreciate all of your help, you guys are usually super spot on.

    Thanks,

    -LM

  2. #2
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Macro for Active X ComboBoxes

    I'm not sure that I understood you correctly, but see if this helps...

    Please Login or Register  to view this content.
    Hope this helps!

  3. #3
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Macro for Active X ComboBoxes

    Hi Domenic!

    Thank you so much for replying so quickly! I just got back into town (was away on business) and was able to try your code.

    The first macro worked flawlessly!!! This has saved me a tremendous amount of time. The relative references for the linked cells are all updated correctly. This is code I will definitely use in the future.


    The second macro did not really do anything. There was no error, but it also did not update the format of the combo boxes. I noticed in visual basic there were only subs for the boxes I originally, manually, applied the format to.

    If we could get this working that would be incredible.

    Thank you so much for your help so far!!

    -LM

  4. #4
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Macro for Active X ComboBoxes

    I'm glad to hear that the first macro works as expected. However, it's unclear to me how the second one should work. Can you please clarify?

  5. #5
    Forum Contributor
    Join Date
    05-23-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Macro for Active X ComboBoxes

    Domenic or Others,

    I have a follow-up to this question. First Domenic, you can ignore my previous secondary question you asked me to clarify. I found a suitable work-around to that problem that I'm happy with.

    However, I'd like to do the same thing we did with the ActiveX Combo Boxes with the Form Control Combo Box (Drop Down).

    I tried this code but it did nothing:

    Sub linkDropDowns()
    Dim OleObj As OLEObject

    For Each OleObj In Worksheets("Income").OLEObjects
    If TypeName(OleObj.Object) = "DropDown" Then
    OleObj.LinkedCell = OleObj.TopLeftCell.Address
    End If
    Next OleObj
    End Sub

    I have tried, for the life of me, to search for how you reference Form Controls versus Active X controls in Macros thinking "OleObj" is the culprit here, but there seems to be zero references online (or no easy to find ones).

    Is is possible to link non-active x controls in the same way we did the active x combo boxes?

    Thanks!

  6. #6
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Macro for Active X ComboBoxes

    Try...

    Please Login or Register  to view this content.
    Hope this helps!

+ 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. filtering comboboxes depend on value of other comboboxes
    By hassan khansa in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-18-2014, 09:18 AM
  2. Macro with reference to active chart on active sheet
    By bhavikpatel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2014, 10:43 AM
  3. Highlight Active Row macro, and Bold the Active Cell
    By StudentTeacher in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-08-2013, 07:43 PM
  4. Macro to Print active sheet as PDF to Active workbook and customize name
    By Scott Taylor in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-17-2012, 08:52 PM
  5. several comboboxes for one active cell
    By ncaravela in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-12-2010, 08:35 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