I have a listbox and I want to set my first row of range as a header. Please help me to correct this code.
Private Sub CommandButton4_Click()
Dim Sh As Worksheet
Set Sh = ThisWorkbook.Sheets("Driver")
With Sh
Set Rng = .Range("A1:A" & .Cells(.Rows.Count, 1).End(xlUp).Row)
End With
With Me.ListBox2
.ColumnCount = 18
.ColumnHeads = True
.ColumnWidths = "0,80,0,0,70,70,70,70,70,70,0,0,0,0,0,43,60,40"
Dim myArray As Variant
myArray = Rng.Resize(, Me.ListBox2.ColumnCount).Value
Me.ListBox2.List = myArray
End With
End Sub