Results 1 to 5 of 5

how can i make this code work as a toggle?

Threaded View

  1. #1
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    how can i make this code work as a toggle?

    i found this post here

    now how can i make this a toggle?
    Private Sub Worksheet_Deactivate()
     ThisWorkbook.Sheets(Array("Sheet3", "Sheet4", "Sheet5", "Sheet6")).Visible = False
    End Sub
    so start with an if statement:
    Private Sub Worksheet_Toggle()
    if sheet3.visible = True then
     ThisWorkbook.Sheets(Array("Sheet3", "Sheet4", "Sheet5", "Sheet6")).Visible = False
    else
     ThisWorkbook.Sheets(Array("Sheet3", "Sheet4", "Sheet5", "Sheet6")).Visible = True
    not sure of the terminology on the IF statement, but once that is figured out, it should work, right?

    thanks for your help.
    Last edited by dmcgov; 05-18-2016 at 12:51 PM. Reason: modded code

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Code is crashing, how can I make this work?
    By liquidmettle in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 01-08-2016, 01:28 AM
  2. Make the below code work faster!!!
    By devpp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-04-2013, 06:13 AM
  3. Replies: 1
    Last Post: 08-14-2013, 12:01 PM
  4. Replies: 5
    Last Post: 08-01-2013, 04:30 AM
  5. how to make code work
    By Oeysbrei in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-29-2012, 06:22 AM
  6. *Add-In Help* Need help to make code into Add-In - List work
    By torontoguy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-18-2011, 03:25 AM
  7. [SOLVED] Toggle Calc Button - how to make it work OK at startup
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2005, 04:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1