+ Reply to Thread
Results 1 to 4 of 4

User Forms with cell formatting and sorting

  1. #1
    Registered User
    Join Date
    01-26-2014
    Location
    South Africa
    MS-Off Ver
    Excel 365 (latest version)
    Posts
    29

    User Forms with cell formatting and sorting

    Good day

    I have a user form with 2 checkboxes (4&5)

    I have checkbox 4 for "AllowSorting"and i need 5 for "AllowCellFormating"

    This is what i have so far but ive tried adding allowcellformating but cannot get both to work together


    Private Sub cmdProtect_Click()
    Dim wSheet As Worksheet
    On Error Resume Next
    For Each wSheet In Worksheets
    If wSheet.ProtectContents = True Then
    wSheet.Unprotect Password:=txtPwd.Text
    Else
    wSheet.Protect Password:=txtPwd.Text, _
    AllowSorting:=CheckBox4.Enabled

    End If
    Next wSheet
    If Err <> 0 Then
    MsgBox "You have entered an incorrect password. All worksheets could not " & _
    "be unprotected.", vbCritical, "Incorrect Password"
    End If
    On Error GoTo 0
    Unload Me
    End Sub

    How would i add it to this macro to make it work

  2. #2
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: User Forms with cell formatting and sorting

    Try this
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-26-2014
    Location
    South Africa
    MS-Off Ver
    Excel 365 (latest version)
    Posts
    29

    Re: User Forms with cell formatting and sorting

    Thank you so much it, worked.....but you already knew it would

  4. #4
    Valued Forum Contributor unit285's Avatar
    Join Date
    10-29-2015
    Location
    TN
    MS-Off Ver
    Office 365
    Posts
    358

    Re: User Forms with cell formatting and sorting

    Quote Originally Posted by pkool View Post
    Thank you so much it, worked.....but you already knew it would
    I'm glad it works for you If you are satisfied with the solution you can set the thread as solved in the Thread Tools Menu at the top. Thanks for the Reputation!

+ 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. [SOLVED] Excel User-forms - referring to a cell in an calculation
    By jdk789 in forum Excel General
    Replies: 3
    Last Post: 09-04-2012, 05:02 AM
  2. [SOLVED] User forms - choosing location of your data to be shown in your user form
    By jasonbwt in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-29-2012, 08:48 AM
  3. User Form to select other User Forms
    By nms2130 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2011, 12:57 PM
  4. Displaying cell contents in user forms
    By duncan beech in forum Excel General
    Replies: 1
    Last Post: 09-15-2008, 10:20 AM
  5. Formatting fields in User Forms
    By maxh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-18-2007, 05:18 PM
  6. [SOLVED] Reading Data from a Cell to a text box-user forms
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-18-2006, 02:32 AM
  7. user forms
    By Obi-Wan Kenobi in forum Excel General
    Replies: 0
    Last Post: 03-21-2006, 04:28 PM
  8. User forms
    By matpj in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-20-2006, 07:31 AM

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