Hello,
I am currently having trouble making my ComboBox ActiveX hide and unhide columns based on range of text in a row. What I would like this code to do is the following:
When a text is selected from the combo box, hide all the columns that DO NOT contain the text in rows C5:M5 and show only the columns with the text. If the combo box is empty, it should show all columns.
This is the code I am working on:
I keep getting an object error. Any help would be greatly appreciated. Thank you so much for your time.![]()
Private Sub ComboBox1_Change() Dim cl As Range Dim Rng As Range, Fnd As Range Set Target.Value = ComboBox1.Value If Target.Address(0, 0) = ComboBox1.Value Then If Target.Value = "" Then Range("C:M").EntireColumn.Hidden = False Else For Each cl In Range("C5:M5") cl.EntireColumn.Hidden = cl.Value <> Target.Value Next cl End If End If End Sub
Sincerely,
JRB
Bookmarks