tonywatsonhelp
Well-known Member
- Joined
- Feb 24, 2014
- Messages
- 3,210
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
Hi Everyone,
Not sure what ive done wrong please help if you can.
I want a macro to filter based on a data in cell M1
But my current code hides all the cells can someone help me or give me a new code that works please?
thanks
Tony
my code
Not sure what ive done wrong please help if you can.
I want a macro to filter based on a data in cell M1
But my current code hides all the cells can someone help me or give me a new code that works please?
thanks
Tony
my code
Code:
Sub Get_Todays_Data()
Application.ScreenUpdating = False
Date1 = Sheets("All Years Data").Range("M1").Value
Sheets("All Years Data").Select
Lastrow = Sheets("All Years Data").Cells(Rows.Count, "A").End(xlUp).Row
If Lastrow < 2 Then
Lastrow = 2
End If
Sheets("All Years Data").Select
Sheets("All Years Data").Range("$A1:$J1").AutoFilter
Sheets("All Years Data").Range("A1", "J" & Lastrow).AutoFilter Field:=3, Criteria1:="=" & Date1
Application.ScreenUpdating = True
End Sub