+ Reply to Thread
Results 1 to 6 of 6

HIding Rows on Workbook Open

Hybrid View

  1. #1
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    HIding Rows on Workbook Open

    Hello! I am looking to make a macro that will hide rows 4-104 everytime the workbook is opened. The reason I am looking to do this is because I want to integrate a "password" field on the top that will require users to input their given password to reveal certain rows. If this could be incorporated into the VBA, that would be great! For example, the password "1234" would unhide rows 10-15, but keep the rest hidden.

    I'm well aware that Excel is not a "secure" in this sense - this is more of a fun project than serious

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,765

    Re: HIding Rows on Workbook Open

    Private Sub Workbook_Open()
        Sheet1.Rows("4:104").EntireRow.Hidden = True
    End Sub
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  3. #3
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this !


    As a beginner starter to paste to the ThisWorkbook class module :

    PHP Code: 
    Private Sub Workbook_Open()
        
    Sheet1.Rows("4:104").Hidden True
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  4. #4
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hi ! Try this !

    Thanks for the help! Regarding the last part of my post, I want to reveal certain rows depending on the password entered. Here's what I have, but I need help adding more. Thanks!

    *EDIT The code below also doesn't recognize when I try to hide the password using the cell format " ;;;** " which just prints it out in all *'s, even though the formula bar still shows "1234"
    Sub Reveal()
        ActiveSheet.Unprotect password:="Password"
        Dim password As String
        password = ActiveSheet.Range("B1").Text
            If InStr(1, password, "1234") Then
            Worksheets("360Review").Range("4:8").EntireRow.Hidden = False
            Else
                Worksheets("360Review").Range("4:8").EntireRow.Hidden = True
            End If
        ActiveSheet.Protect password:="Password"
    End Sub
    Last edited by xAcrosonicx; 08-16-2019 at 12:43 PM.

  5. #5
    Registered User
    Join Date
    06-20-2019
    Location
    Minnesota
    MS-Off Ver
    Office 2019
    Posts
    39

    Re: Hi ! Try this !

    I ended up writing it all out by hand in a very long and obnoxious nested If statement.

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    Instead of some nested If you may use the Select Case statement …

+ 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. Unexpected Error when hiding the ribbon during workbook open event - Excel 2016
    By pguillet07 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-19-2018, 07:55 AM
  2. Hiding a single Workbook when userform is open
    By NirXY in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-14-2013, 07:31 PM
  3. Hiding Rows Across a Workbook
    By bacon1987 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-18-2012, 08:17 PM
  4. Hiding the ribbon ONLY in my workbook, but not in other open workbooks?
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-26-2011, 07:32 AM
  5. Automatically hiding rows when I open Excel
    By Wykie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-16-2010, 09:27 AM
  6. Hiding rows:a large workbook
    By phreak008 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2010, 09:31 AM
  7. File won't open after hiding rows
    By mkingsley in forum Excel General
    Replies: 1
    Last Post: 04-21-2005, 04:20 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