Results 1 to 31 of 31

This VB code to hide a row is only working for one sheet, and not the entire workbook?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-07-2009
    Location
    cedar grove
    MS-Off Ver
    Excel 2003
    Posts
    133

    This VB code to hide a row is only working for one sheet, and not the entire workbook?

    Hello,

    I have a script, that should be working on any sheet, since I have it in the workbook area.

    What it is supposed to do is, when I type the word done, in a field on any of the group worksheets (group1, group2 or group3), it automatically hides that row in that sheet, as well as that row in the overview sheet. The overview sheet, is a sheet that contains a paste link of each row from any of the 3 additional sheets. If I go to the group1 sheet and type the word done in any row, it hides that row in that sheet and the overview sheet, no problem. But, if I do the same thing in group2 or group3 sheet, the row itself hides in that sheet, but not in the overview sheet????

    Can someone look at this code and tell me what is wrong?

    I have also attached my file so you can see what I am trying to achieve.

    thanks so much!!
    babs


    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Dim x%
    If Target.Count > 1 Then Exit Sub
    If Target.Address = "$A$1" Then GoTo search 'Change $A$1 to whichever cell reference you want
    
    If UCase(Target.Value) = "DONE" Then
      Rows(Target.Row).Hidden = True
    Sheets("Overview").Rows(Target.Row).Hidden = True
    
      On Error Resume Next
      Sheets("Overview").Rows(Target.Row).Hidden = True
    End If
    Exit Sub
    
    search:
    On Error Resume Next
    If UCase(Target.Value) = "DONE" Then Exit Sub
    x = Cells.Find(What:=Target.Value, After:=Cells(1, 1), LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Row
    If Cells(x, 1).EntireRow.Hidden = True Then
    Cells(x, 1).EntireRow.Hidden = False
    Rows(x & ":" & x).Replace What:="DONE", Replacement:="un-done", LookAt:=xlWhole, SearchOrder:=xlByRows, MatchCase:=False
    End If
    
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 20
    Last Post: 01-11-2014, 05:39 AM
  2. code not working for copied sheet in same workbook
    By banhisikha.basak in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2013, 06:32 AM
  3. VBA to hide sheet in workbook and also reference in code
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-21-2011, 07:20 PM
  4. [SOLVED] Code to hide Entire row based on criteria
    By ram in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-09-2006, 05:35 PM
  5. Hide an entire row - Not working
    By Mark in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2005, 05:05 PM

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