ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can I print a list of custom views (https://www.excelbanter.com/excel-discussion-misc-queries/143913-can-i-print-list-custom-views.html)

James Quigley

Can I print a list of custom views
 
I need to print a list of custom views that have been established. Is there a
way?

Nick Hodge

Can I print a list of custom views
 
James

This code will add a sheet called CustomViews and list them and whether they
have their print and filter settings turned on. There is currently no
checking for the Custom View sheet existing but that could be simply added.
Print this sheet then.

Sub ListCustomViews()
Dim view As CustomView
Dim viewWks As Worksheet
Dim cntr As Integer
If ActiveWorkbook.CustomViews.Count = 0 Then
MsgBox "There are no views", vbInformation + vbOKOnly
Exit Sub
End If
Set viewWks = ActiveWorkbook.Worksheets.Add
With viewWks
.Name = "Custom Views"
With .Range("A1:C1")
.Value = Array("View Name", _
"Print Settings", "Filter Settings")
.Font.Bold = True
End With
End With
cntr = 2
For Each view In ActiveWorkbook.CustomViews
With viewWks
.Range("A" & cntr).Value = view.Name
.Range("B" & cntr).Value = view.PrintSettings
.Range("C" & cntr).Value = view.RowColSettings
End With
cntr = cntr + 1
Next view
viewWks.Range("A:C").Columns.AutoFit
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk
blog (non-tech): www.nickhodge.co.uk/blog/


"James Quigley" wrote in message
...
I need to print a list of custom views that have been established. Is there
a
way?




All times are GMT +1. The time now is 06:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com