Custom View - VBA to Modify/Save a view?

D

Dennis

Custom Views is a very interesting capability.

That said, Excel does not provide a way to modify a view then save it.

Currently, one has to:
- delete a view
- set it back up with the modifications (which can take considerable time)
- then save it

Does anyone have a VBA or other solution to this challenge?

TIA Dennis
 
D

Dave Peterson

I could show a view, make modifications and then use that same name when I
"create" a new view.

Manually, excel gives me a warning, but via a macro, it didn't.

This kind of code worked ok:

Option Explicit
Sub createAtestView()

With ActiveSheet
.Range("a:b").EntireColumn.Hidden = True
.Parent.CustomViews.Add viewname:="test1", _
PrintSettings:=True, RowColSettings:=True
End With

End Sub
Sub modifyView()
ActiveWorkbook.CustomViews("test1").Show
With ActiveSheet
.Range("C:C").EntireColumn.Hidden = True
.Parent.CustomViews.Add viewname:="test1", _
PrintSettings:=True, RowColSettings:=True
End With
End Sub
 
D

Dave Peterson

I know I'm one of the many(?) who don't use custom views.

I find just hiding/unhiding columns in code just as easy. And I think it's
easier to update. You can see what the code is doing--instead of trying to
notice what the worksheet is set for.

I know others use them in their work (customer requests???).
 
D

Dennis

Understand Dave,

This is for an application for my wife's work environment.

She learns quickly, but views are a quick way to set 10 sheets properly for printing
then re-set same for data entry.

Dennis
 
D

Dave Peterson

That sounds like a nice application of custom views.

Another option would be to make 10 different macros that accomplished the same
thing and give them a little toolbar that did each "view".
 
Top