referring to selection from multi-select userform

K

kidkarma

Hi,

I have a multiselect userform whereby the user chooses values that are
sourced from a headings on a worksheet.

The values that are chosen I would like to show, but the values that
aren't I would like to hide the entire column.

I'm really not enjoying vba at the mom.

Here is the code which i keep getting 'object required'

Private Sub CommandButton1_Click() 'This is the code linked to the
'ok' button on the multiselect userform

Rng = Sheets("BS Method").Range("Filter_Entname").Columns.Count - 2
RngCellValue = Sheets("BS Method").Range("Filter_Entname")
StartCell = Sheets("BS Method").Range("E9")
Application.ScreenUpdating = False
For i = 1 To Rng
If StartCell.Value <> ListBox1.Selection Then
Selection.EntireColumn.Hidden = True
Else
StartCell.Offset(0, 1).Select
End If
Next i
Application.ScreenUpdating = True
End Sub

Sorry for posting such 'beginner' questions

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top