Computer Hope

Software => Computer software => Topic started by: RedBorg on March 20, 2016, 05:06:52 PM

Title: VBA Excel need to add what column to look at to this macro
Post by: RedBorg on March 20, 2016, 05:06:52 PM
Hi,
I have a working macro that targets all of the ComboBoxes in my worksheet. I need it to only target whatever Column I choose. The Column will be the location of the comboBoxe's.  Here's what I have that works but does every comboBox on my sheet.
Code: [Select]
    Sub AllocateLinkedCellsToComobBoxes()
        Dim cbo As OLEObject
        For Each cbo In ActiveSheet.OLEObjects
        If TypeOf cbo.Object Is ComboBox Then
            cbo.Select
            Selection.LinkedCell = Selection.TopLeftCell.Address
            cbo.LinkedCell = cbo.TopLeftCell.Address
        End If
      Next
    End Sub