Compile Error:

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
Compile Error:
Can't find Project or Library

Sub Userform_Button()
Dim Msg As String
Dim i As Integer
Dim NextRow As Long

Worksheets("Tables").Select

Range("L1").Select
' Determine the next empty row
NextRow = Application.WorksheetFunction. _
CountA(Range("L:L")) + 1
' Transfer the selected items from ListBox
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
c = c + 1
Cells(LastRow + c, 12) = ListBox1.List(i, 0)
End If
Next i

End Sub

It is selecting teh second "c" inthe second row above End If. I dont know what the problem is? Thanks!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
where do i learn how to use tags?

just as I showed you


Code:
Sub Userform_Button()
 Dim Msg As String
    Dim i As Integer
    Dim NextRow As Long

    Worksheets("Tables").Select
    
    Range("L1").Select
'   Determine the next empty row
    NextRow = Application.WorksheetFunction. _
       CountA(Range("L:L")) + 1
'   Transfer the selected items from ListBox
    For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
c = c + 1
Cells(LastRow + c, 12) = ListBox1.List(i, 0)
End If
Next i

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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