Userform-Database ListCount Permission Denied

cmxulb

Board Regular
Joined
Nov 24, 2020
Messages
52
Office Version
  1. 365
Platform
  1. Windows
Hi,
Im trying to auto scroll to the bottom after an input, but I'm getting the error ""Permission Denied"

Private Sub UserForm_Activate()

lstDatabase.AddItem lstDatabase
lstDatabase.ListIndex = lstDatabase.ListCount - 1


End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I don't know why you're getting a "Permission Denied" error, but the following line should give you a "Type mis-match" error..

Code:
lstDatabase.AddItem lstDatabase

That's because you cannot add a listbox to a listbox.
 
Upvote 0
The error indicates that you're referring to a folder for which you do not have access privileges. So you must have some other line of code that is causing the error. When the error occurs and the dialog box is displayed, click on Debug. Which line of code is highlighted?
 
Upvote 0
This code take me to this line
lstDatabase.ListIndex = lstDatabase.ListCount - 1
1606842712726.png


and if I add this 2nd code
lstDatabase.AddItem lstDatabase .it says "Pemission denied"
 
Upvote 0
When I try running your code, it gives me a type mis-match error, and it highlights this line...

VBA Code:
lstDatabase.AddItem lstDatabase

As I have already mentioned, you cannot add a listbox to your listbox. What is it you're trying to do?
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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