ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Toggle Custom Views (https://www.excelbanter.com/excel-programming/367469-toggle-custom-views.html)

GregR

Toggle Custom Views
 
Is there macro lnaguage to toggle between custom views? TIA

Greg


Tom Hutchins

Toggle Custom Views
 
I don't use custom views, but why not use the macro recorder while switching
between views, then see what code it generates?

Hope this helps,

Hutch

"GregR" wrote:

Is there macro lnaguage to toggle between custom views? TIA

Greg



Chip Pearson

Toggle Custom Views
 
Try something like

Sub ToggleViews()
Static ViewName As String
If ViewName = "View1" Then
ThisWorkbook.CustomViews("View2").Show
ViewName = "View2"
Else
ThisWorkbook.CustomViews("View1").Show
ViewName = "View1"
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"GregR" wrote in message
ps.com...
Is there macro lnaguage to toggle between custom views? TIA

Greg




GregR

Toggle Custom Views
 
Chip, thank you very much, that did the trick

Greg
Chip Pearson wrote:
Try something like

Sub ToggleViews()
Static ViewName As String
If ViewName = "View1" Then
ThisWorkbook.CustomViews("View2").Show
ViewName = "View2"
Else
ThisWorkbook.CustomViews("View1").Show
ViewName = "View1"
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"GregR" wrote in message
ps.com...
Is there macro lnaguage to toggle between custom views? TIA

Greg




All times are GMT +1. The time now is 07:13 AM.

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