Results 1 to 3 of 3

Thread: Userform Disaster in VBA excel:-(

  1. #1

    Unhappy Userform Disaster in VBA excel:-(



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi everyone, I really hope someone would kindly guide me in my first attempt at using VBA. I've created a userform with multipages, my form originally loaded up from excel but now it doesn't, my main problem with the multipage is with moving from one page to the next it seems that there are 2 out of the 3 pages that are not working properly and my combo boxes don't work, I've literally gone through about 10 help videos, gone through online notes and I can't seem to get it working. With the exception of my schedule repair button the other forms don't appear to load up. I don't want to give up but I desperately need to get the form up and running. I would appreciate your help please. thx you in advance (thanks to Roy for helping me earlier in the week, I think I fixed that problem but then created another one for myself by deciding to change the userform)
    Attached Files Attached Files

  2. #2
    Conjurer royUK's Avatar
    Join Date
    Mar 2011
    Location
    Derbyshire, UK
    Posts
    155
    Articles
    0
    Excel Version
    most versions
    Your code uses Named Ranges to populate ComboBoxes, there are no named ranges in that workbook.

    Looping through a Range to populate the ComboBox is inefficient and using the List property of the combobox would be better.
    Hope that helps

    Roy

  3. #3
    Conjurer royUK's Avatar
    Join Date
    Mar 2011
    Location
    Derbyshire, UK
    Posts
    155
    Articles
    0
    Excel Version
    most versions
    Code to populate ComboBoxes
    Code:
    Private Sub UserForm_Initialize()
    
    
    
    
        Dim WS As Worksheet
        Set WS = Worksheets("lookuplists")
    
    
        With WS.Cells(1, 1).CurrentRegion
            Me.cbocategory.List = .Columns(1).Value
            Me.cboassettype.List = .Columns(2).Value
            Me.cbopurchasetype.List = .Columns(3).Value
            Me.cbolocation.List = .Columns(4).Value
        End With
    
    
    End Sub
    This fixes one problem but there are missing controls or wrong names of controls in the code. Try debugging the code 7 these errors will be highlighted in yellow
    Hope that helps

    Roy

Posting Permissions

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