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:
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...
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...