S
Scott
Hi,
I have a Listbox. When I first open the spreadsheet, the Listbox
values text don't visually appear. I can click on the spots in the
listbox where the text is and thereafter it appears. Alternately, if
I switch tabs and then come back it also shows properly.
It seems to be due to ScreenUpdating; however I do this after the
values have been populated (same result putting it before). If the
ScreenUpdating portion is completely removed, it displays the values
text properly. However, I'd prefer to have ScreenUpdating disabled
for the second section of code.
I'm populating the values in Workbook_Open, code as below.
Thanks, Scott
-------------------------------------------------------
Private Sub Workbook_Open()
Dim i As Long
'Application.ScreenUpdating = False '<== Initial position of
ScreenUpdating
With wksMomMpaScatter
For i = 0 To ReportPlantsInfo.Range("ReportPlantListFull").Count -
1
.ListBox1.AddItem
ReportPlantsInfo.Range("ReportPlantListFull").Cells(i + 1, 1)
.ListBox1.Selected(i) =
ReportPlantsInfo.Range("ReportPlantListFull").Offset(0, 1).Cells(i +
1, 1)
Next i
End With
Application.ScreenUpdating = False '<== Alternate position for
ScreenUpdating
.... {Other code} ....
Application.ScreenUpdating = True
End Sub
I have a Listbox. When I first open the spreadsheet, the Listbox
values text don't visually appear. I can click on the spots in the
listbox where the text is and thereafter it appears. Alternately, if
I switch tabs and then come back it also shows properly.
It seems to be due to ScreenUpdating; however I do this after the
values have been populated (same result putting it before). If the
ScreenUpdating portion is completely removed, it displays the values
text properly. However, I'd prefer to have ScreenUpdating disabled
for the second section of code.
I'm populating the values in Workbook_Open, code as below.
Thanks, Scott
-------------------------------------------------------
Private Sub Workbook_Open()
Dim i As Long
'Application.ScreenUpdating = False '<== Initial position of
ScreenUpdating
With wksMomMpaScatter
For i = 0 To ReportPlantsInfo.Range("ReportPlantListFull").Count -
1
.ListBox1.AddItem
ReportPlantsInfo.Range("ReportPlantListFull").Cells(i + 1, 1)
.ListBox1.Selected(i) =
ReportPlantsInfo.Range("ReportPlantListFull").Offset(0, 1).Cells(i +
1, 1)
Next i
End With
Application.ScreenUpdating = False '<== Alternate position for
ScreenUpdating
.... {Other code} ....
Application.ScreenUpdating = True
End Sub