PDA

View Full Version : Solved: Can these 2 VBA codes be merged in to 1



Toonies
09-08-2011, 09:27 AM
Hi and thanks for looking

Is it possible to combine the following 2 Vba codes

both work fine alone
Private Sub UserForm_Initialize()
ComboBox1.List = Worksheets("January-June").Range("B6:B45").Value

End Sub

Private Sub UserForm_Initialise()
ComboBox1.List = Worksheets("July - December").Range("B6:B45").Value
End Sub

many thanks

Toonies

xld
09-08-2011, 09:35 AM
Private Sub UserForm_Initialize()
Dim cell As Range

With ComboBox1

.List = Worksheets("January-June").Range("B6:B45").Value
' .List = Worksheets("July-December").Range("B6:B45").Value
For Each cell In Worksheets("July-December").Range("B6:B45")

.AddItem cell.Value
Next cell
End With
End Sub

Toonies
09-08-2011, 10:29 AM
xld many thanks again

:beerchug:

Toonies