+ Reply to Thread
Results 1 to 2 of 2

Hide/Unhide Rows when clicking between two tabs in Workbook

  1. #1
    Registered User
    Join Date
    07-29-2014
    Location
    San Francisco
    MS-Off Ver
    2010
    Posts
    2

    Hide/Unhide Rows when clicking between two tabs in Workbook

    Hey All,

    I have the following code that works great when I run it manually but, I need it to run automatically when I switch between two sheets in a workbook. Does anyone know of any ways to tweak the code so that it runs automatically? I've tried Worksheet_change event but, cant seem to make it work.

    Thanks

    Sub hurows()
    BeginRow = 5
    EndRow = 94
    ChkCol = 4

    For RowCnt = BeginRow To EndRow
    If Cells(RowCnt, ChkCol).Value > 0 Then
    Cells(RowCnt, ChkCol).EntireRow.Hidden = False
    Else
    Cells(RowCnt, ChkCol).EntireRow.Hidden = True
    End If
    Next RowCnt
    End Sub
    Last edited by jdesro04; 11-20-2014 at 05:30 PM.

  2. #2
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Hide/Unhide Rows when clicking between two tabs in Workbook

    Hi,

    how about the "Worksheet_Activate()" event? This would make sense if you want to run this on one or two sheets, if the majority of sheets should have that code run when it is activated use the "Private Sub Workbook_SheetActivate(ByVal Sh As Object)" event from the "ThisWorkbook" module.

    Cheers!
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 09-22-2014, 05:57 AM
  2. Automatically run vba
    By arrongraham in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2013, 09:18 AM
  3. [SOLVED] How to Automatically Copy New Data into the next sheet and have it automatically sorted??
    By ReedDOT in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-24-2013, 10:50 AM
  4. Add a row, automatically
    By SixStringMadness in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2011, 03:03 PM
  5. Automatically increment formula automatically
    By Brianboy_24 in forum Excel General
    Replies: 1
    Last Post: 08-27-2010, 09:35 PM

Tags for this Thread

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