Home > Excel Tutorial > ListBox Column Adding & Deleting

ListBox Column Adding & Deleting

In The ListBox Column Adding – Deleting |  Listbox Column Control

         Before in this template ,we fill data to the listbox from  page with following codes :

ListBox1.ColumnWidths = “92;140;110;65;65;35;40;65;65;115;150;65”

ListBox1.ColumnCount = 12

ListBox1.List = Sheets(“Data”).Range(“A2:L” & [A65536].End(3).Row).Value

listbox column delete

After ,  those columns that we choose   can be removed  with check boxes. It does not affect the data on this page.

Codes of Checkbox1 :

Private Sub CheckBox1_Click()

Application.ScreenUpdating = False

If CheckBox1.Value = True Then

For sat = 2 To Cells(65536, 1).End(xlUp).row

ListBox1.AddItem

ListBox1.List(s, 0) = Cells(sat, 1)

s = s + 1

Next

     Else

For i = 0 To ListBox1.ListCount – 1

        ListBox1.column(0, i) = Empty

     Next i

End If

Application.ScreenUpdating = True

End Sub

Download Template

 

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: