ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code Enhancement? (https://www.excelbanter.com/excel-programming/450092-code-enhancement.html)

dfisher111

Code Enhancement?
 
Hello,

I have the following code that updates combo boxes located on a dashboard panel and are linked to a dynamic named range. The code is used to display dates in a friendly format vs a serial code. The combo boxes allow users to choose a "from" and "to" date for a dataset range. On an analysis tab, I have sumifs calculating from a raw dataset based upon the filters from the combo box on the dashboard. Every time I change the filter in my combo box, the data is calculating very slowly. I see the calculation msg in the lower right of the screen go from 0-100% about 4 times. I'm wondering if the sumifs are calculating each time the macro runs from private sub to end sub. Are there any ideas to make this process faster? I'm a little newer to vba. Any help appreciated; thanks!

Private Sub ComboBox1_Change()
Me.ComboBox1.Value = Format(Me.ComboBox1.Value, "mmm-yyyy")
End Sub

Private Sub UserForm_Initialize()
Me.ComboBox1.RowSource = "dates_for_dv"
Me.ComboBox1.Value = Format(Me.ComboBox1.Value, "mmm-yyyy")
End Sub

Private Sub ComboBox2_Change()
Me.ComboBox2.Value = Format(Me.ComboBox2.Value, "mmm-yyyy")
End Sub

Private Sub UserForm2_Initialize()
Me.ComboBox2.RowSource = "dates_for_dv"
Me.ComboBox2.Value = Format(Me.ComboBox2.Value, "mmm-yyyy")
End Sub


All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com