Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks.
I'm trying. best regards jiang "BrianB " wrote in message ... Something like this :- '------------------------------------------------------ Private Sub CommandButton1_Click() Dim ColumnName As String Dim ListBoxItem As String Dim MatchColumn As Boolean '--------------------------- c = 1 Do MatchColumn = False ColumnName = UCase(ActiveSheet.Cells(1, c).Value) For i = 0 To ListBox2.ListCount - 1 ListBoxItem = UCase(ListBox2.List(i)) If ListBoxItem = ColumnName Then MatchColumn = True Exit For End If Next If MatchColumn = False Then ActiveSheet.Columns(c).EntireColumn.Delete Else c = c + 1 End If Loop While ActiveSheet.Cells(1, c).Value < "" '--------------------------- End Sub '----------------------------------------- --- Message posted from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sorting in a Pivot Table unselected fields | Excel Worksheet Functions | |||
How to delete at once empty columns in a table? | Excel Discussion (Misc queries) | |||
Delete Unselected Rows | Excel Discussion (Misc queries) | |||
merge text from 2 columns into 1 then delete the old 2 columns | Excel Worksheet Functions | |||
Pivot Table Creating New Columns that Subtract Two Existing Columns | Excel Discussion (Misc queries) |