+ Reply to Thread
Results 1 to 2 of 2

Worksheet.Protection generates error code 1004

  1. #1
    Forum Contributor
    Join Date
    07-21-2021
    Location
    Norfolk, UK
    MS-Off Ver
    Excel 2003, 2007, 2013, 2019
    Posts
    212

    Worksheet.Protection generates error code 1004

    This is code I have used in similar situations many times before, without problems.

    However, the statement
    Please Login or Register  to view this content.
    now generates the general error 1004. The context is shown below.

    Please Login or Register  to view this content.
    Curiously, if I substitute
    Please Login or Register  to view this content.
    the code proceeds without hindrance, but that isn't really a suitable work around.

    Advice please.
    Last edited by swaatacba; 09-17-2021 at 10:38 AM.
    Regards,

    Stephen

  2. #2
    Forum Contributor
    Join Date
    07-21-2021
    Location
    Norfolk, UK
    MS-Off Ver
    Excel 2003, 2007, 2013, 2019
    Posts
    212

    Re: Worksheet.Protection generates error code 1004

    It seems that the VBA code for .Protection.AllowEditRanges(0) has changed since I last used it. AllowEditRanges.Add is now a method in its own right and some parameters must be stipulated. These are outlined as AllowEditRanges.Add method (Excel). These are new to me and appear to have been added in early 2019.

    However, I noted another criterion in the form of .AllowInsertingHyperlinks. These permitted the revision of my code, which worked as expected. The code is shown below.


    Please Login or Register  to view this content.

+ 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. Union Range CountIf generates RunTime Error 1004
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-25-2019, 10:07 AM
  2. Replies: 0
    Last Post: 03-05-2019, 03:14 PM
  3. [SOLVED] Code selecting cell with data generates 1004 error
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-21-2018, 08:27 AM
  4. [SOLVED] Code generates 400 error
    By BRISBANEBOB in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-06-2014, 02:33 AM
  5. [SOLVED] Macro button generates "run time error 1004 [FileName] could not be found' msg
    By dawnmau in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-12-2012, 11:55 AM
  6. [SOLVED] range.offset generates a Run Time error 1004
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2006, 12:50 PM
  7. Password protection with grouping causes error 1004
    By michelr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-12-2006, 05:54 AM

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