RobbieC
Active Member
- Joined
- Dec 14, 2016
- Messages
- 376
- Office Version
- 2010
- Platform
- Windows
Hi there, I have a userform with a listbox which is populated from a range on another sheet.
I can get it all to work using:
but if there is only 1 value in my range (which is likely to happen), it give me a 381 error...
I can't see where I'm going wrong
If you can point me in the right direction, that'd be brilliant. Thanks
I can get it all to work using:
Code:
Private Sub UserForm_Initialize()
Dim ListRange As Range
Set ListRange = Worksheets("Sheet7").Range("A1:A100")
[I][B] If ListRange.Count = 1 Then[/B][/I]
[I][B] ListBox1.AddItem ListRange.Value[/B][/I]
Else
ListBox1.List = Worksheets("Sheet7").Range("A1").CurrentRegion.Value
End If
End Sub
but if there is only 1 value in my range (which is likely to happen), it give me a 381 error...
I can't see where I'm going wrong
If you can point me in the right direction, that'd be brilliant. Thanks