Greetings everybody
So I have the following code as part of a userform I modified slightly from a Book (Excel 2010: Power Programming with VBA). I cant seem to see the attached image but what I get is the headers with a selection box next to it, what I want is for the first row to not be selectable. I need the headers but I don't want the user to be able to select them. I already programmed around this, since the macro ignores this selection but it looks unfinished with this issue. Will appreciate any and all support.
I know this could probably be explained better but I can't find an easy way to explain
Private Sub UserForm_Initialize()
Dim ColCnt As Integer
Dim rng As Range
Dim cw As String
Dim c As Integer
ColCnt = ActiveSheet.UsedRange.Columns.Count
Set rng = ActiveSheet.UsedRange
With ListBox1
.ColumnCount = ColCnt
.RowSource = rng.Address
cw = ""
For c = 1 To .ColumnCount
cw = cw & rng.Columns(c).Width & ";"
Next c
.ColumnWidths = cw
.ListIndex = 0
End With
End Sub
Bookmarks