Increment ActiveX ComboBox from firstvalue to lastvalue

Waimea

Active Member
Joined
Jun 30, 2018
Messages
465
Office Version
  1. 365
Platform
  1. Windows
I have two activex comboboxes, combobox1 and combobox2, that I want to increment with VBA from firstvalue to lastvalue.

How can I change the value of the combobox so that I can see when it changes value from firstvalue to secondvalue to thirdvalue etc.. ??


So far I have found that they are OLEObjects. I found a bit of code that counts all ActiveX comboboxes in a worksheet.

Code:
Sub try()


Dim Ws As Worksheet
Set Ws = Worksheets("Jämföra")
Count = 0


For Each OleObj In Ws.OLEObjects
    If OleObj.OLEType = xlOLEControl Then
        If TypeName(OleObj.Object) = "ComboBox" Then
            Count = Count + 1
        End If
    End If
Next OleObj


MsgBox "Number of ComboBoxes :" & Count


End Sub
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Cross posted https://www.excelforum.com/excel-pr...2124-for-each-loop-with-activex-combobox.html

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.

also here https://www.ozgrid.com/forum/forum/...-macros/1207140-loop-through-activex-combobox
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,182
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top