Results 1 to 3 of 3

Thread: [RESOLVED] Hide Rows on non-active worksheet without activation

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2008
    Location
    South Africa
    Posts
    32

    Resolved [RESOLVED] Hide Rows on non-active worksheet without activation

    Hi Guys - some help please.

    I am trying to hide rows in another worksheet without selecting it. My current code is as follows:

    ---------------------------------------------------------------------
    Sub modRowHide(SheetName As String, RowName As String, QtyCell As String)

    Sheets(SheetName).Select
    Range(RowName).Select
    Selection.EntireRow.Hidden = True

    Sheets("Menu").Select
    Range(QtyCell).Select
    Selection.Font.ColorIndex = 2
    ActiveCell.FormulaR1C1 = "0"

    End Sub
    ----------------------------------------------------------------------

    Problem is that the constant jumping between sheets every time it makes it an active sheet is irretating to the eye as the module is run several times in repeat.

    Any suggestions?

  2. #2
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: Hide Rows on non-active worksheet without activation

    You don't need to select sheet and/or cell.
    Code:
    Sheets(SheetName).Range(RowName).EntireRow.Hidden = True
    
    With Sheets("Menu").Range(QtyCell)
       .Font.ColorIndex = 2
       .FormulaR1C1 = "0"
    End With
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2008
    Location
    South Africa
    Posts
    32

    Re: Hide Rows on non-active worksheet without activation

    Thanks anhn - it does the trick. So simple!

Posting Permissions

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



Click Here to Expand Forum to Full Width