Busybeaver
New Member
- Joined
- Nov 26, 2010
- Messages
- 20
Hi, I have 10 comboboxes - all require exactly the same list. Rather than having to copy the list 10 times in the coding - and changing the combobox name from listcode1, listcode2 etc, is there a loop code which I can add to do this for me??
Private Sub Userform_Initialize()
'Empty txtdate
txtdate.Value = ""
'Empty txtpayer
txtpayer.Value = ""
'Empty txtorderno
txtorderno.Value = ""
'Fill listcode1
With listcode1
.AddItem "TLNZ-1"
.AddItem "TLNZ-2"
.AddItem "TLNZ-3"
.AddItem "TLNZ-5"
.AddItem "TLNZ-6"
.AddItem "TLNZ-7"
.AddItem "TLNZ-8"
.AddItem "TLNZ-9"
.AddItem "TLNZ-10"
.AddItem "TLNZ-11"
.AddItem "TLNZ-12"
.AddItem "TLNZ-13"
.AddItem "TLNZ-14"
.AddItem "TLNZ-15"
.AddItem "TLNZ-16"
.AddItem "TLNZ-17"
.AddItem "TLNZ-18"
End With
'Set Focus on listbranch1
listbranch1.SetFocus
End Sub
Thanks
Private Sub Userform_Initialize()
'Empty txtdate
txtdate.Value = ""
'Empty txtpayer
txtpayer.Value = ""
'Empty txtorderno
txtorderno.Value = ""
'Fill listcode1
With listcode1
.AddItem "TLNZ-1"
.AddItem "TLNZ-2"
.AddItem "TLNZ-3"
.AddItem "TLNZ-5"
.AddItem "TLNZ-6"
.AddItem "TLNZ-7"
.AddItem "TLNZ-8"
.AddItem "TLNZ-9"
.AddItem "TLNZ-10"
.AddItem "TLNZ-11"
.AddItem "TLNZ-12"
.AddItem "TLNZ-13"
.AddItem "TLNZ-14"
.AddItem "TLNZ-15"
.AddItem "TLNZ-16"
.AddItem "TLNZ-17"
.AddItem "TLNZ-18"
End With
'Set Focus on listbranch1
listbranch1.SetFocus
End Sub
Thanks