Custom View - VBA to Modify/Save a view?

  • Thread starter Thread starter Dennis
  • Start date Start date
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
 
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
 
Dave,

Thanks so very much for writing the code. Over time, I noted
that there are very few questions/answers re: Custom Views.

Apparently, not many use Custom Views. I wonder why.

I guess I expected that there would be 2-3 answers all with
"off-the-shelf" VBA from websites.

I walked to my computer to turn it off and re-read this NG.

Tomorrow morning, I will test your contribution.

One major positive attribute about the Excel NG group is how
hard the "members" work to ais others.

Again Thanks!

Dennis
 
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???).
 
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
 
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".
 
Back
Top