error can't find project to library when run the form

Ali M

Active Member
Joined
Oct 10, 2021
Messages
304
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
Hi
I try running the form , but shows error can't find project to library in this word
VBA Code:
newButton
for this line
VBA Code:
  Set newButton = Me.Controls.Add("Forms.CommandButton.1", , True)
this is code
VBA Code:
Private Sub UserForm_Initialize()
  
    Dim lastRow As Long
    lastRow = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row

    Dim i As Integer
    For i = 1 To lastRow
        Set newButton = Me.Controls.Add("Forms.CommandButton.1", , True)
        With newButton
            .Caption = Sheets("Sheet1").Cells(i, 2).Value
            .Left = 10
            .Top = 20 + (i - 1) * 30
        End With
    Next i
End Sub
how fix this error please?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
In the VB Editor, click Tools - References on the menu and look for one of the selected items that is prefixed with 'MISSING:' in the name.
 
Upvote 0
thanks , I did it and found the item is selected and I make it unselected but still shows the error!
 
Upvote 0
I've found what's the problem .
there are two selected items that is prefixed with 'MISSING:' in the name
every think is ok now
thanks buddy;)
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top