Results 1 to 4 of 4

VBA Compile Error: Expected End Sub

Threaded View

  1. #1
    Registered User
    Join Date
    09-21-2017
    Location
    SLC, Utah
    MS-Off Ver
    2016
    Posts
    7

    VBA Compile Error: Expected End Sub

    Howdy:

    I have a very simple macro to unprotect a tab, refresh a pivot table on that tab and reprotect the tab:

    ' Macro3 Macro
    '
    Private Sub Button5_Click()
        ActiveSheet.Unprotect Password:="expenseallocation"
        ActiveSheet.PivotTables(2).PivotCache.Refresh
        ActiveSheet.Protect Password:="expenseallocation"
    End Sub
    When I run the macro, I get an Expected End Sub error even though I clearly have an End Sub statement. What am I doing wrong? Thx.
    Last edited by alansidman; 01-18-2021 at 01:45 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] compile error expected: (
    By kevinu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2018, 03:10 AM
  2. Compile Error: Expected End With
    By Sanjibghosh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2017, 06:48 AM
  3. [SOLVED] compile error expected sub
    By citypro in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-04-2015, 11:06 AM
  4. Compile error: Expected End Sub
    By MacroCoder in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-06-2013, 04:05 PM
  5. Compile Error: Expected End With?
    By Jeka__7 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2013, 10:30 AM
  6. Compile error: Expected End Sub
    By Leeboy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-31-2011, 09:44 AM
  7. Compile Error: Expected End Sub
    By Lothar69 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-27-2011, 10:55 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