View Single Post
  #1   Report Post  
dfisher111 dfisher111 is offline
Junior Member
 
Posts: 1
Default 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