+ Reply to Thread
Results 1 to 4 of 4

VBA Button to Show all worksheets as READ ONLY

  1. #1
    Registered User
    Join Date
    02-23-2016
    Location
    England
    MS-Off Ver
    MS 2013
    Posts
    2

    Lightbulb VBA Button to Show all worksheets as READ ONLY

    Hi all,

    I am currently trying to create a button within my workbook which will "reveal" all worksheets as read only.

    I have a password protected button to 'Show all' worksheets within the workbook, the code for that being:

    Sub ShowAll_Click()
    Dim ws As Worksheet
    Dim wb As Workbook
    Dim i As Integer
    Dim strResponse As String

    strResponse = InputBox("Please enter the password.", "Password")

    If strResponse = "Test" Then
    Dim wsSheet As Worksheet
    Application.ScreenUpdating = False
    For Each wsSheet In Worksheets
    wsSheet.Visible = True
    Next wsSheet
    Application.ScreenUpdating = True

    Else

    MsgBox "The password entered is incorrect.", vbCritical, "Incorrect Password"

    Exit Sub

    End If

    End Sub

    How do I update this to only show all worksheets in a read only format?

    Many thanks!!

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2012
    Location
    Unknown
    MS-Off Ver
    Unseen
    Posts
    429

    Re: VBA Button to Show all worksheets as READ ONLY

    There isn't really a Read Only format for a worksheet. By default, all cells on a worksheet are locked. However, that only has any effect if the worksheet is protected with a password.

    So, in essence, you would need to ensure that all cells on each worksheet are locked and each worksheet is protected with a password. Could be the same password or a different one. You'd then need a mechanism to UnProtect the sheet if you want the user to make changes.

  3. #3
    Registered User
    Join Date
    02-23-2016
    Location
    England
    MS-Off Ver
    MS 2013
    Posts
    2

    Re: VBA Button to Show all worksheets as READ ONLY

    Thanks InvisableMan, you have pointed me in the right direction!

  4. #4
    Valued Forum Contributor
    Join Date
    05-14-2012
    Location
    Unknown
    MS-Off Ver
    Unseen
    Posts
    429

    Re: VBA Button to Show all worksheets as READ ONLY

    You're welcome. Thanks for the rep.

+ 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. Press a Button to Show They Have Read and When
    By Sal1tech in forum Excel General
    Replies: 1
    Last Post: 05-14-2015, 05:15 PM
  2. Press a Button to Show They Have Read and When
    By Sal1tech in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-14-2015, 02:18 AM
  3. Replies: 2
    Last Post: 08-14-2014, 06:03 AM
  4. Read from file and show line
    By dusan rupnik in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2010, 10:32 PM
  5. Replies: 4
    Last Post: 11-17-2008, 12:15 PM
  6. Why Do My Documents Show As Read-Only For Others?
    By Vilja in forum Excel General
    Replies: 2
    Last Post: 08-17-2006, 03:01 AM
  7. [SOLVED] Show cells have been read - linked
    By ufo_pilot in forum Excel General
    Replies: 0
    Last Post: 08-05-2005, 12: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