Is there a way to stop a Listbox from flickering when it is updating with data?
I have a listbox on a Multipage on a userform, when the data goes into the sheet it shows in the listbox. However as the data goes into the sheet the listbox flicker, which become a bit annoying.
In my main code, which is a FOR LOOP, i have tried Application.ScreenUpdating = False
and set it back to true at the end, but nothing seems to work. I can't seem to find the answer on google.
This is my code, which is in the sheet change event. I have NO code in the listbox
Private Sub Worksheet_Change(ByVal Target As Range)
With ExcelForm.UrlsListBox1
.ColumnCount = 1
.ColumnWidths = "600"
.RowSource = "'" & Sheet2.Name & "'!$A$1:$b$" & Sheet2.Cells(Sheet2.Rows.Count, 1).End(xlUp).row
End With
End Sub
FOR INFO - My user form has several multipages and each page has a listbox each has its own sheet. So I can not just place this code in form initialize, as it has to be relevent to that multipage + listbox when the tab is selected.
This is an updated code not 100% sure if this is what Zac was advising on
Private Sub Worksheet_Change(ByVal Target As Range)
With ExcelForm.UrlsListBox1
If Not Intersect(Target, Range("A:A")) Is Nothing Then
.RowSource = "'" & Sheet2.Name & "'!$A$1:$b$" & Sheet2.Cells(Sheet2.Rows.Count, 1).End(xlUp).row
End If
End With
End Sub
The Listbox flicking as NOT stopped
Also Posted on Mr Excel Today at 1:51pm uk time Link
Intersect
for that). Also, try commenting outColumnCount
andColumnWidths
lines – ZacPrivate Sub Worksheet_Change(ByVal Target As Range) With ExcelForm.UrlsListBox1 ' .ColumnCount = 1 ' .ColumnWidths = "600" .RowSource = "'" & Sheet2.Name & "'!$A$1:$b$" & Sheet2.Cells(Sheet2.Rows.Count, 1).End(xlUp).row End With End Sub
– Sharid