Im trying to add coloumn heads to my listbox but its just not working
i was using rowsource to use the first row of the sheet as the headings however this just set the values in the listbox to the rowsource
Here is my code
If Area = "" Then
Dim c As Range
Zip = "*" + Zip + "*"
Me.ListBox1.Clear
For Each c In Range([e2], [e65000].End(xlUp))
If UCase(c) Like UCase(Zip) Then
With Me.ListBox1
.AddItem c
.List(.ListCount - 1, 0) = c.Offset(0, -4).Value
.List(.ListCount - 1, 1) = c.Offset(0, -3).Value
.List(.ListCount - 1, 2) = c.Offset(0, -2).Value
.List(.ListCount - 1, 3) = c.Offset(0, -1).Value
.List(.ListCount - 1, 4) = c.Offset(0, 0).Value
.List(.ListCount - 1, 5) = c.Offset(0, 1).Value
.List(.ListCount - 1, 6) = c.Offset(0, 2).Value
.List(.ListCount - 1, 7) = c.Offset(0, 3).Value
End With
End If
Next c
Else
Dim b As Range
Area = "*" + Area + "*"
Me.ListBox1.Clear
For Each b In Range([F2], [F65000].End(xlUp))
If UCase(b) Like UCase(Area) Then
With Me.ListBox1
.AddItem b
.List(.ListCount - 1, 0) = b.Offset(0, -5).Value
.List(.ListCount - 1, 1) = b.Offset(0, -4).Value
.List(.ListCount - 1, 2) = b.Offset(0, -3).Value
.List(.ListCount - 1, 3) = b.Offset(0, -2).Value
.List(.ListCount - 1, 4) = b.Offset(0, -1).Value
.List(.ListCount - 1, 5) = b.Offset(0, 0).Value
.List(.ListCount - 1, 6) = b.Offset(0, 1).Value
.List(.ListCount - 1, 7) = b.Offset(0, 2).Value
End With
End If
Next b
End If
Any help would be much appreciated
Bookmarks