dualhcsniatpac
Board Regular
- Joined
- Feb 18, 2009
- Messages
- 126
I would like to leave out the header rows. When the form is initialized I cant figure out how to leave out the first 2 rows. I am not the original author of this code so thats why I am having trouble. Any help will do.
Thanks
Thanks
Code:
Private Sub UserForm_Initialize()
Dim ColCnt As Integer
Dim rng As Range
Dim cw As String
Dim c As Integer
fname = "High Volume Scrap " & Format(Date, "yyyy") & ".xls"
SheetName = Format(Date, "mmmm")
' Sets the working directory
ChDir ("C:\Test\")
On Error Resume Next
Workbooks.Open Filename:="C:\Test\" & fname
Sheets(SheetName).Select
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