VBA Code For Daily Updates

DSpink95

New Member
Joined
Feb 20, 2020
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Hi All,

I'm currently in the process of creating a system that will make viewing jobs for each day easier.
I currently have a central sheet with all information in for received work but I want to be able to have an option to click on a button with the current dates on and it shows only information from that date clicked. As the date on the button will change on a daily basis (linked with a formula to change based on todays date) what code could I use that will pull through the info for that date - data is in a worksheet called "All Jobs" cells B2:R and when the date is clicked I want it to open just that dates work - potentially in another tab "Daily View" any help would be appreciated!

1582209856565.png
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Code below assumes that the boxes are all shapes (like rectangles)
- assign the macro below to all the shapes
- ensure that how dates appear in the "box" is identical to how they look in the sheet
- the code filters data in the original sheet
- can modify to dump to another sheet if required

Using Application caller it avoids having to identify the object by name, but it does not work with everything
- modify the code so that the correct object text is read into variable boxText

VBA Code:
Sub FilterDates()
    Dim boxText As String
    boxText = ActiveSheet.Shapes(Application.Caller).TextFrame.Characters.Text
    
    With Sheets("All Jobs").Range("A1")
        On Error Resume Next
        .Parent.ShowAllData
        .AutoFilter
        .AutoFilter Field:=1, Criteria1:=boxText
        .Parent.Activate
    End With
End Sub
 
Upvote 0
Yongle - thank you for your help! Looks like it has done the trick
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,552
Members
449,088
Latest member
davidcom

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