Hi everyone,
I am having having problems trying to clear the contents of two ListBoxes on a Userform.
It errors out on the line ctrl.Clear![]()
Please Login or Register to view this content.
Thanks for looking into this.
Hi everyone,
I am having having problems trying to clear the contents of two ListBoxes on a Userform.
It errors out on the line ctrl.Clear![]()
Please Login or Register to view this content.
Thanks for looking into this.
![]()
Please Login or Register to view this content.
My General Rules if you want my help. Not aimed at any person in particular:
1. Please Make Requests not demands, none of us get paid here.
2. Check back on your post regularly. I will not return to a post after 4 days.
If it is not important to you then it definitely is not important to me.
What is the error number and error message when it errors out?
thanks mehmetcik.
I tried your code but it still doesn't clear the ListBoxes.
Thank Rick for looking into this.
Strangely my original code works now. I don't even know what happend. I don't remember the exact error code message, it was "Object.....".
This works:
I don't see anything different in the code.![]()
Please Login or Register to view this content.
Were you loading the Listbox using RowSource?
Place in a Module and call as required.
![]()
Please Login or Register to view this content.
Yes, one of the ListBox gets loaded from RowSource:
![]()
Please Login or Register to view this content.
Thanks torachan,
your code clears TextBoxes but not ListBoxes.
On Error Resume Next
For Each ctrl In Userform2.Controls
ctrl.Value = ""
ctrl.listindex = -1
Ctrl.clear
Next ctrl
On Error Goto 0
Hi mehmetcik,
it cleared the whole userform blank. All the TextBoxes and ListBoxes are gone. That's strange.![]()
Please Login or Register to view this content.
Last edited by Xceller; 03-13-2020 at 02:01 PM.
You cannot use Clear if you use rowsource, it's best to load them like![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks