I have a sheet with a report that I build using VBA to filter and get the value into the sheet. Normaly I use the filter in Excel 2010 with the criteria "xlFilterYesterday" but, some times I need to put a different date.
I added a calendar control in the main sheet where i have the buttons to start the macros in the workbook. I tried many things, but I just don't get it how to pass the date to a filter from the calendar control
How can I use Calendar1 to pass the date to Criteria1.
Sub Cases_Received() Dim mySubtotal As Double Sheets("Raw_Data").Activate With Sheets("Raw_Data") .AutoFilterMode = False Rows("1:1").Select Selection.AutoFilter Worksheets("Raw_Data").Range("$A$1:$DB$56000").AutoFilter Field:=38, Criteria1:=xlFilterYesterday, Operator:=xlFilterDynamic End With mySubtotal = Application.WorksheetFunction.Subtotal(3, Worksheets("Raw_Data").Range("A2:A56000")) Worksheets("Snap_Shot").Range("B3").Value = mySubtotal End Sub