Results 1 to 3 of 3

Thread: Solved: Can these 2 VBA codes be merged in to 1

  1. #1
    VBAX Regular
    Joined
    Feb 2011
    Posts
    34
    Location

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

    Hi and thanks for looking

    Is it possible to combine the following 2 Vba codes

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

    End Sub[/VBA]

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

    many thanks

    Toonies

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    [vba]

    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Feb 2011
    Posts
    34
    Location
    xld many thanks again



    Toonies

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •