Results 1 to 3 of 3

Thread: Error when trying to use COMBO BOXES PADLOCK

  1. #1
    Member
    Join Date
    Aug 2012
    Posts
    72
    Rep Power
    13

    Error when trying to use COMBO BOXES PADLOCK

    Hi
    I need your help again, I'm doing the project created two comboboxes padlocks, where one depends on the other, but this error message appearing.
    time error '-2147467259 (80004005)

    unspecified error
    I used this code:
    Code:
    Private Sub ComboBox7_Change()
        ComboBox7 = UCase(ComboBox7)
        Call CarregaCargos(Me.ComboBox7.List(Me.ComboBox7.ListIndex))
    End Sub
    Code:
    Private Sub UserForm_Initialize()
        Call CarregaGrupos
    End Sub
    Code:
    Private Sub CarregaGrupos()
        Dim linha As Integer, coluna As Integer
        linha = 2
        coluna = 1
        Me.ComboBox7.Clear
        With Sheets("G_Cargos")
            Do While Not IsEmpty(.Cells(linha, coluna))
                Me.ComboBox7.AddItem .Cells(linha, coluna).Value
                linha = linha + 1
            Loop
        End With
    End Sub
    Code:
    Private Sub CarregaCargos(ByVal Cargos As String)
        Dim linha As Integer, colunaCargos As Integer, colunaGrupos As Integer
        linha = 2
        colunaCargos = 1
        colunaGrupos = 2
        Me.ComboBox8.Clear
        With Sheets("Cargos")
            Do While Not IsEmpty(.Cells(linha, colunaCargos))
                If .Cells(linha, colunaGrupos).Value = G_Cargos Then
                    Me.ComboBox8.AddItem .Cells(linha, colunaCargos).Value
                End If
                linha = linha + 1
            Loop
        End With
    End Sub
    My file in:
    Download ErroComboBox.xlsm from Sendspace.com - send big files the easy way

    Thank you!!

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    You are using RowSource property of combobox to list the values. So don't need to loop and add the items. Otherwise just remove the namedrange from the rowsource property of respective comboboxes. Also check your sheet names.
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  3. #3
    Member
    Join Date
    Aug 2012
    Posts
    72
    Rep Power
    13
    Hi.
    I followed your suggestion and it worked, thank you!!
    problem solved!

Similar Threads

  1. Difference Between 'On Error GoTo 0' And 'On Error GoTo -1'
    By Transformer in forum Familiar with Commands and Formulas
    Replies: 7
    Last Post: 07-02-2015, 04:07 PM
  2. One userform and 60 Combo Boxes
    By k0st4din in forum Excel Help
    Replies: 11
    Last Post: 04-25-2013, 09:55 AM
  3. Replies: 11
    Last Post: 10-07-2012, 12:05 AM
  4. Replies: 2
    Last Post: 09-25-2012, 01:30 AM
  5. Number validation in Text Boxes VBA
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 2
    Last Post: 05-17-2012, 02:48 PM

Posting Permissions

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