View and Cell Sum Range

G

Guest

I am looking for a way to change the view i.e. change hidden columns
representing months and change the cell range sum within a totals column
depending on which view (month) is selected. I am able to change the view by
month but the cell range in the totals column does not change with custom
view feature. Is there anyway to do this at one time without having to
create a new file for each month?
Thank you.
 
D

Don Guillett

Here is one I just did for a client that should give you the idea. This one
hides all days that are not the day of the date in the target cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$B$4" Then Exit Sub
Application.ScreenUpdating = False
Set myrng = Range("c5:bd5")
[myrng].EntireColumn.Hidden = False
For Each c In [myrng]
If c <> Format([b4], "Ddd") then c.EntireColumn.Hidden = True
Next c
Application.ScreenUpdating = True
End Sub

Sub UnhideAllColumns()
Columns.EntireColumn.Hidden = False
End Sub
 
G

Guest

Thank you for the hepl Don

Don Guillett said:
Here is one I just did for a client that should give you the idea. This one
hides all days that are not the day of the date in the target cell.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$B$4" Then Exit Sub
Application.ScreenUpdating = False
Set myrng = Range("c5:bd5")
[myrng].EntireColumn.Hidden = False
For Each c In [myrng]
If c <> Format([b4], "Ddd") then c.EntireColumn.Hidden = True
Next c
Application.ScreenUpdating = True
End Sub

Sub UnhideAllColumns()
Columns.EntireColumn.Hidden = False
End Sub

--
Don Guillett
SalesAid Software
(e-mail address removed)
Dewayne said:
I am looking for a way to change the view i.e. change hidden columns
representing months and change the cell range sum within a totals column
depending on which view (month) is selected. I am able to change the view by
month but the cell range in the totals column does not change with custom
view feature. Is there anyway to do this at one time without having to
create a new file for each month?
Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top