We help IT Professionals succeed at work.
Get Started

Hide columns by date criteria

Charlie9200
Charlie9200 asked
on
208 Views
Last Modified: 2012-05-12
Hi - I am using excel 2003 and need to modify the VBA for ThisWorkbook (see below) to automatically reduce row height of rows to .4 with dates in Worksheet Labelled "Health Check Scorecard" that are prior to today's date and any dates that are today+365X2 (2 years).  the VBAProject list indicates in Sheet2.

Is it possible to do something similar to Sheet1(XYZ) and Sheet8(ABC):  however in these 2 sheets, I would like to just automatically hide all rows with dates that are less than today - 6months.    

Is it possible to adjust the macro below to reflect above?  

thanks in advance for your help.
ub Workbook_Open()

  Application.ScreenUpdating = False
    Dim wkSht As Worksheet


    For Each wkSht In ActiveWorkbook.Worksheets
        With wkSht
            If .ProtectContents = True Then .Protect UserInterfaceOnly:=True, AllowFiltering:=True, Password:="awake"
            If .AutoFilterMode Then
                If .FilterMode Then
                    .ShowAllData
                End If
            Else
                If .FilterMode Then
                    .ShowAllData
                End If
            End If
          If .Visible = xlSheetVisible Then
            .Select
            .[a1].Select
 
            With ActiveWindow
              .Zoom = 75
              .ScrollRow = 1
              .ScrollColumn = 1
            End With
          End If
        End With
    Next wkSht
     
    Worksheets(1).Select
  Application.ScreenUpdating = True
End Sub
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE