Results 1 to 1 of 1

Allow user to edit dynamic range on protected sheet

Threaded View

  1. #1
    Registered User
    Join Date
    09-08-2018
    Location
    Kamloops, Canada
    MS-Off Ver
    Office 365
    Posts
    86

    Allow user to edit dynamic range on protected sheet

    I need to open up a dynamic range to allow a user to edit the data there. I have the following code;

    Sub resetALL()
    
        Sheet22.Unprotect
        
        Dim PVcolumn As Long
        Dim TR As Long
        
        PVcolumn = Rows(9).Find("Planned Value", , xlValues, xlWhole, , , 0).Column
        TR = Columns("C").Find("Total", , xlValues, xlWhole, , , 0).Row
        
        Range("F10", Cells(TR - 1, PVcolumn)).Formula = "=IF(OR($C10="""",F$9=""""),"""",IF(AND($C10=""Total"",F$9>0,F$9>$E$4),SUM(OFFSET(F$10,0,0,COUNTA($B$10#),1)),IF(AND($C10=""Total"",F$9=""Planned Value""),SUM(OFFSET(F$10,0,0,COUNTA($B$10#),1)),IF(AND($C10=""Total"",F$9=""Remaining""),$E10-E10,IF(AND($C10=""Total"",F$9=""Spent""),SUMIFS(EffortPC,PostingDate,""<""&CEILING(EOMONTH($E$4,0)-5,7)),IF(AND($C10=""Total"",F$9>0),SUMIFS(EffortPC,PostingDate,"">=""&CEILING(EOMONTH(F$9,-1)-5,7),PostingDate,""<""&CEILING(EOMONTH(F$9,0)-5,7)),IF(F$9=""Spent"",SUMIFS(EffortPC,HeirarchyCode,$B10,PostingDate,""<""&CEILING(EOMONTH($E$4,0)-5,7)),IFERROR(IF(F$9=""Remaining"",$E10-E10,IF(F$9=""Planned Value"",SUM(OFFSET(G10,0,0,1,COUNT(G$9:$CA$9))),SUMIFS(EffortPC,HeirarchyCode,$B10,PostingDate,"">=""&CEILING(EOMONTH(F$9,-1)-5,7),PostingDate,""<""&CEILING(EOMONTH(F$9,0)-5,7)))),""""))))))))"
        Range("F" & TR & ":AZ" & TR).Formula = "=IF(OR($C" & TR & "="""",F$9=""""),"""",IF(AND($C" & TR & "=""Total"",F$9>0,F$9>$E$4),SUM(OFFSET(F$10,0,0,COUNTA($B$10#),1)),IF(AND($C" & TR & "=""Total"",F$9=""Planned Value""),SUM(OFFSET(F$10,0,0,COUNTA($B$10#),1)),IF(AND($C" & TR & "=""Total"",F$9=""Remaining""),$E10-E10,IF(AND($C" & TR & "=""Total"",F$9=""Spent""),SUMIFS(EffortPC,PostingDate,""<""&CEILING(EOMONTH($E$4,0)-5,7)),IF(AND($C" & TR & "=""Total"",F$9>0),SUMIFS(EffortPC,PostingDate,"">=""&CEILING(EOMONTH(F$9,-1)-5,7),PostingDate,""<""&CEILING(EOMONTH(F$9,0)-5,7)),IF(F$9=""Spent"",SUMIFS(EffortPC,HeirarchyCode,$B" & TR & ",PostingDate,""<""&CEILING(EOMONTH($E$4,0)-5,7)),IFERROR(IF(F$9=""Remaining"",$E" & TR & "-E" & TR & ",IF(F$9=""Planned Value"",SUM(OFFSET(G" & TR & ",0,0,1,COUNT(G$9:$CA$9))),SUMIFS(EffortPC,HeirarchyCode,$B" & TR & ",PostingDate,"">=""&CEILING(EOMONTH(F$9,-1)-5,7),PostingDate,""<""&CEILING(EOMONTH(F$9,0)-5,7)))),""""))))))))"
        
        AllowEditRange.Add Title:="PlannedValues", Range:=Range(Cells(Rows(10), PVcolumn + 1), Cells(TR - 1, Columns("AZ")))
        
        Sheet22.Protect
        
    End Sub
    I unprotect the sheet to begin because the formulas need to be placed in the correct rows and columns. Then I want to allow the user to edit the range. Then I need to protect the sheet.

    What am I missing on my AllowEditRange line? I get a 'typemismatch' error.
    Attached Images Attached Images

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Dynamic Drop Down list locked by Edit Objects in protected sheet
    By Kestrel Aviation in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-01-2020, 03:09 AM
  2. [SOLVED] still able to the edit the work sheet which i have protected
    By Bergi in forum Excel - New Users/Basics
    Replies: 10
    Last Post: 04-28-2020, 12:12 PM
  3. [SOLVED] Edit protected sheet
    By RMontani in forum Excel General
    Replies: 2
    Last Post: 12-07-2017, 03:51 PM
  4. [SOLVED] Allow user to edit ranges on a protected sheet
    By aleenkhan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-27-2012, 03:27 AM
  5. Allow user to edit ranges on a protected shared workbook
    By aleenkhan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-26-2012, 01:38 PM
  6. Allow user to edit ranges on a protected sheet
    By aleenkhan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-17-2012, 04:46 PM
  7. Protected Sheet Allow Edit Objects
    By jonhfl in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-11-2011, 10:38 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