Hide row where Date less than this month

lapta301

Well-known Member
Joined
Nov 12, 2004
Messages
1,001
Office Version
  1. 365
Platform
  1. Windows
I have dates in column C from row 8 and would like to have a macro which on accessing the sheet would hide all rows where the month and year of the date in column C is less than the now.

So as at today I would only want to see rows from July onwards.

As ever my thanks for any assistance
 
Fair enough appreciate the time that you have spent on this thank you
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi,
try modification to NoSparks original suggestion to include type conversion function Clng & see if it will now work for you


Rich (BB code):
Private Sub Worksheet_Activate()
    With Range("C7", Range("C" & Rows.Count).End(xlUp))
        .AutoFilter Field:=1, _
        Criteria1:=">=" & CLng(DateSerial(Year(Date), Month(Date), 1)), _
        Operator:=xlFilterValues
    End With
End Sub

Dave
 
Upvote 0
Hi Dave thank you and it seems to be working a treat. Much appreciated
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,016
Members
448,936
Latest member
almerpogi

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