UserForm Listbox Populating doesn't work properly!

Sabotage

Board Regular
Joined
Sep 19, 2013
Messages
58
Hi All,
I have a dilemma with one of my UserForms. In a nutshell this tablet is recording data by the user's entering information. This questioned UserForm is a function for a supervisor to check on the user randomly. Updating the main ComboBox is triggering the refresh method Here is my code and I have two questions after:

Code:
Private Sub cb_LoadID_Change()
Dim RD, MN As Worksheet
Set RD = Sheets("RecData")
Set MN = Sheets("Main")
Application.ScreenUpdating = False
[B][COLOR=#006400]RD.Activate[/COLOR][/B]
    With RD
    .Range("A2:E2").AutoFilter Field:=3, Criteria1:=cb_LoadID.Value
    lRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    Set myRNG = .Range("A3:E" & lRow).SpecialCells(xlCellTypeVisible)
[B][COLOR=#006400]    Application.Calculate[/COLOR][/B]
        With lbox_Shoes
            .RowSource = myRNG.Address
        End With
        With lbl_TotalWeight
            .Caption = Format(RD.Range("G2").Value, "##,########")
        End With
        With lbl_TotalBoxes
            .Caption = RD.Range("H2").Value
        End With
        With lbl_User
            .Caption = RD.Range("I2").Value
        End With
    End With
[B][COLOR=#006400]MN.Activate[/COLOR][/B]
Application.ScreenUpdating = True
End Sub

Q1 - I am trying to populate a filtered range into a ListBox object on a UserForm but it only works if I activate the worksheet with the filtered data. If I don't activate the sheet with the data on, the UserForm's ListBox populates from ActiveSheet this case MN. My part solution for this is to activate/deactivate the sheet "RD.Activate" + "MN.Activate" but I believe that activating shouldn't be necessary. Is there another way of doing this?

Q2 - on RD I have few cells that keep refreshing summary information based on the filtered data. In other words when filtering the data set on RD these cells will dynamically calculate the visible cells in various columns. These values then being projected onto the UserForm labels. The problem with this is that it populates the values on the first time, but then it keeps the value when the ComboBox is changed. Part solution again is to re-calculate the workbook with "Application.Calculate". But is this necessary? Is there another way of doing this better?


Thank you in advance...
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,215,695
Messages
6,126,263
Members
449,307
Latest member
Andile

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