• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Hide all Columns Prior to a Specified Date

Simsy

New Member
I have a stock depletion spreadsheet where I need to hide all columns prior to the date which will be specified in Cell E3
65606


I have the below VBA
65604

But when I enter the date in Cell E3 it will only hide the Columns containing Date values prior to the date specified in Cell E3 but will not hide columns containing text.
65605

My question is, how do I hide all columns from Column F to the specified date, not just Columns containing date Values?

Thanks in advance
 
This should be easy enough but few people are going to want to reproduce your setup from pictures to test their suggestions.
Put together a workbook, it only needs one of your sheets, delete sensitive data and attach it here.
 
Thanks so much for your guidance, I am very new to forums so all the help I can get will be greatly appreciated. I have now attached the workbook below.
 

Attachments

  • Stock Depletion Forum Copy.xlsm
    430.3 KB · Views: 1
See attached wherein:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRng As Range, x
Set myRng = Range("F7:OP7")
x = Application.Match(Range("E3").Value2, Application.Index(myRng.Value2, 0), 0)
myRng.EntireColumn.Hidden = False
If Not IsError(x) Then myRng.Resize(, x - 1).EntireColumn.Hidden = True
End Sub
 

Attachments

  • Chandoo43621Stock Depletion Forum Copy.xlsm
    431.4 KB · Views: 2
Back
Top