Forgot Code for last post

  • Thread starter Thread starter Jahsonn
  • Start date Start date
J

Jahsonn

Private Sub UserForm_Initialize()
Dim rng As Range
Dim rw As Long, sh As Worksheet
Dim bStart As Boolean


rw = 17
For Each sh In ActiveWorkbook.Worksheets
If bStart Then
Worksheets("Control").Cells(rw, 2).Value = sh.Name
rw = rw + 1
End If
If sh.Name = Worksheets(4).Name Then bStart = True
Next


With Worksheets("Control")
Set rng = .Range(.Cells(17, 2), .Cells(Rows.Count, 2).End
(xlUp))
End With
With Me.ListBox1
..Clear
..List = rng.Value
End With

End Sub
 
With Worksheets("Control")
Set rng = .Range(.Cells(17, 2), _
.Cells(Rows.Count, 2).End(xlUp))
End With
With Me.ListBox1
.Clear
if rng.count > 1 then
.List = rng.Value
Else
.AddItem rng.Value
End if
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top