ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Detecting active customview (https://www.excelbanter.com/excel-discussion-misc-queries/1908-detecting-active-customview.html)

Bart

Detecting active customview
 
Hello

I have to create a piece of code wich makes a few buttons visible or in
visible depending of te active customview that is selected on a sheet.It has
to be something like this:

Private Sub Worksheet_Activate()
If (ACTIVECUSTOMVIEW = view1) then
CommandButton1.Visible = False
End If

If (ACTIVECUSTOMVIEW = view2) then
CommandButton1.Visible = True
End If
End Sub


Thanks in advance...



Andy Brown

I'm not a proper coder, maybe someone else will chip in. However, I couldn't
find anything on this, so if it *can't* be done, I'd suggest checking for a
view *condition*. So if View1 involved column C being hidden, something
like:

If Sheets("Sheet1").Columns(3).Hidden = True Then
MsgBox "You're in View1."
'do stuff
Else
MsgBox "You're in View2."
'do other stuff
End If

HTH,
Andy


"Bart" wrote in message
...
Hello

I have to create a piece of code wich makes a few buttons visible or in
visible depending of te active customview that is selected on a sheet.It

has
to be something like this:

Private Sub Worksheet_Activate()
If (ACTIVECUSTOMVIEW = view1) then
CommandButton1.Visible = False
End If

If (ACTIVECUSTOMVIEW = view2) then
CommandButton1.Visible = True
End If
End Sub


Thanks in advance...






All times are GMT +1. The time now is 06:30 AM.

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