0
votes

Actually I made the project in Excel VBA , and I wanted to hide ThisWorkbook.visible=False when the files open and then load the userform. However I the project is running fantastic but when i hide my thisworkbook then i am getting an error like "method rows of object _global failed" on For Cmb = 2 To .Cells(Rows.Count, 27).End(xlUp).Row

Sub ComboAddItems()
    Dim Lc, Cmb, CmbItm As Integer
    With ThisWorkbook.Worksheets("Tool Work")
        For Cmb = 2 To .Cells(Rows.Count, 27).End(xlUp).Row
            Lc = .Range(.Cells(Cmb, 28), .Cells(Cmb, 28).End(xlToRight)).Count
            For CmbItm = 1 To Lc
                UserForm1.Controls(.Cells(Cmb, 27).Value).AddItem .Cells(Cmb, 27 + CmbItm).Value
            Next CmbItm
        Next Cmb
    End With
End Sub
1

1 Answers

1
votes

You're missing a qualifier:

For Cmb = 2 To .Cells(.Rows.Count, 27).End(xlUp).Row

note the full stop before the Rows.