Hide/Unhide Columns representing dates as per Current System Date!
Elijaz,
Here's some workbook open code
Private Sub Workbook_Open()
Dim iDay As Long
With Worksheets("Sheet1")
.Columns("A:AE").Hidden = True
iDay = Day(Date)
.Columns(iDay).Hidden = False
If Hour(Now) < 12 And iDay 1 Then
.Columns(iDay - 1).Hidden = False
End If
End With
End Sub
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"gr8guy" wrote in message
...
Hi,
If i have 31 columns having 31 days ( in mm/dd/yy format - made into text)
&
i want to hide the columns showing current date - 1 & i also want to hide
the columns showing current date1( i.e. before midnight), & just show the
column showing current date as Visible, how do i do that on opening the
workbook? Also, since i am working night shifts, after 12:00 midnight
,there
should be 2 columns available that is the previous current date column for
some time say till next 12 hours & the new column which became visible
only
after midnight.
How is it possible using VBA?
Rgds,
Eijaz
|