How to protect Excel cells while allowing VBA to modify them?

I want to allow users to modify inputs in some Unlocked cells and have the other cells update accordingly. I also want to prevent users from clobbering those other cells, so those are Locked.
Protect Sheet allows ordinary formulas in Locked cells to execute but, by default, prevents VBA functions from executing when their input cells are modified. So, after consulting the
Excel 2013 developer reference's descriptions of the Worksheet.Protect method and
Worksheet object, I added these statements to my initialization routine:
Worksheets(1).Activate
ActiveSheet.Protect "", UserInterfaceOnly = True
The 2nd statement enables Protect Sheet with a null password successfully, but the UserInterfaceOnly setting isn't having the effect I expected, i.e., allowing the VBA functions to execute when their input cells are changed. (I've noticed it seems to enable
the Allow Users to Edit Objects protection option.)
I also tried := True, but that doesn't help.

The function fails because you cannot change characteristics of a chart in a worksheet function. A worksheet function can only return a value to the cell that contains the formula.
You can use the Worksheet_Change event to modify the chart instead. The function can be simplified to
Function Show_RGB(Y, u, v, Swatch) As Variant
Dim R As Single, G As Single, B As Single
On Error GoTo ErrHandler
R = R_from_Yuv(Y, u, v)
G = G_from_Yuv(Y, u, v)
B = B_from_Yuv(Y, u, v)
Show_RGB = Array(R, G, B) ' Allow <0 and >255 in spreadsheet
ExitHandler:
Exit Function
ErrHandler:
MsgBox Err.Description, vbExclamation
Resume ExitHandler
End Function
The Worksheet_Change event procedure in the worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim R As Single, G As Single, B As Single, Swatch As Integer
Dim rng As Range
On Error GoTo ErrHandler
If Not Intersect(Range("B3:D14"), Target) Is Nothing Then
Worksheets(1).Unprotect
For Each rng In Intersect(Range("B3:D14"), Target)
R = Cells(rng.Row, 5)
G = Cells(rng.Row, 6)
B = Cells(rng.Row, 7)
Swatch = rng.Row - 2
R = WorksheetFunction.Max(0, (WorksheetFunction.Min(255, R))) ' ...avoid runtime error when changing displayed color
G = WorksheetFunction.Max(0, (WorksheetFunction.Min(255, G)))
B = WorksheetFunction.Max(0, (WorksheetFunction.Min(255, B)))
With Worksheets(1).ChartObjects(6).Chart.SeriesCollection(1)
.Points(Swatch).MarkerBackgroundColor = RGB(R, G, B)
.DataLabels(Swatch).Font.Color = RGB(R, G, B)
End With
Next rng
End If
ExitHandler:
Worksheets(1).Protect
Exit Sub
ErrHandler:
MsgBox Err.Description, vbExclamation
Resume ExitHandler
End Sub
See
https://www.dropbox.com/s/nylonrp0y86lq1c/FAA%20palette%20designer%20Beta%2002.xlsm?dl=1
Regards, Hans Vogelaar (http://www.eileenslounge.com)

Similar Messages

  • Protect a document while allowing insertion of data in a table and points on a chart.

    I have created a Word document that includes a table and a chart.  Can I protect the document but allow entry of data into the table and allow points to be placed on the chart using Adobe?

    Hi brianh89327665,
    While you can apply a permissions password to a PDF to prevent things such as printing and changing the document, you can't apply it selectively to parts of the PDF.
    Best,
    Sara

  • How to color particular cell while working REUSE_ALV_HIERSEQ_LIST_DISPLAY

    Hi All,
    I am working with REUSE_ALV_HIERSEQ_LIST_DISPLAY  function module to diaplay hierarchial list. Now my requirement is to color particular cells in the output based on condition. Can any one help me in this regard.
    Thanks and Regards,
    Srinadh.

    hi ,
    try this..
    * FIELD CATALOG
    DATA : it_field TYPE slis_t_fieldcat_alv,                       "internal table for field catalog
           wa_field TYPE slis_fieldcat_alv.                         "work area for field catalog
    * FOR LAYOUT OF ALV GRID
    DATA : wa_layout TYPE slis_layout_alv.                          "work area for layout design
    *&      Form  SET_LAYOUT
    *       SUB-ROUTINE SET_LAYOUT IS USED TO SET THE DISPLAY OF THE
    *       ALV GRID LINES IN ALTERNATIVE COLOURS
    FORM set_layout .
      wa_layout-zebra = 'X'.
    ENDFORM.                    " SET_LAYOUT
    *&      Form  ALV_DISPLAY
    *       SUB-ROUTINE ALV_DISPLAY IS USED TO SET THE PARAMETERS
    *       FOR THE FUNCTION MODULE REUSE_ALV_GRID_DISPLAY
    *       AND PASS THE INTERNAL TABLE EXISTING THE RECORDS TO BE
    *       DISPLAYED IN THE GRID FORMAT
    FORM alv_display .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *     I_INTERFACE_CHECK                 = ' '
    *     I_BYPASSING_BUFFER                = ' '
    *     I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = 'SY-REPID '
    *     I_CALLBACK_PF_STATUS_SET          = ' '
    *     I_CALLBACK_USER_COMMAND           = ' '
    *     I_CALLBACK_TOP_OF_PAGE            = ' '
    *     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *     I_CALLBACK_HTML_END_OF_LIST       = ' '
    *     I_STRUCTURE_NAME                  =
    *     I_BACKGROUND_ID                   = ' '
    *     I_GRID_TITLE                      =
    *     I_GRID_SETTINGS                   =
         is_layout                         = wa_layout
         it_fieldcat                       = it_field
    *     IT_EXCLUDING                      =
    *     IT_SPECIAL_GROUPS                 =
    *     IT_SORT                           =
    *     IT_FILTER                         =
    *     IS_SEL_HIDE                       =
    *     I_DEFAULT                         = 'X'
    *     I_SAVE                            = ' '
    *     IS_VARIANT                        =
    *     IT_EVENTS                         =
    *     IT_EVENT_EXIT                     =
    *     IS_PRINT                          =
    *     IS_REPREP_ID                      =
    *     I_SCREEN_START_COLUMN             = 0
    *     I_SCREEN_START_LINE               = 0
    *     I_SCREEN_END_COLUMN               = 0
    *     I_SCREEN_END_LINE                 = 0
    *     I_HTML_HEIGHT_TOP                 = 0
    *     I_HTML_HEIGHT_END                 = 0
    *     IT_ALV_GRAPHICS                   =
    *     IT_HYPERLINK                      =
    *     IT_ADD_FIELDCAT                   =
    *     IT_EXCEPT_QINFO                   =
    *     IR_SALV_FULLSCREEN_ADAPTER        =
    *   IMPORTING
    *     E_EXIT_CAUSED_BY_CALLER           =
    *     ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_final
    *   EXCEPTIONS
    *     PROGRAM_ERROR                     = 1
    *     OTHERS                            = 2
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "alv_display
    regards
    Ritesh J

  • I'm wondering how to passcode specific apps, like email, while allowing use of other iPad apps,,, any suggestions?, I'm wondering how to passcode specific apps, like email, while allowing use of other iPad apps,,, any suggestions?

    I'd like to password protect my email while allowing other use on my iPad, for business. Any ideas?

    right now, there are none.  the device was built more or less on a one user model.  you can either passcode the whole thing, or not.  you can set restrictions on certain things.  and for email, simply do not use the email app, but rather use web mail, where you have to log on each time you want to use it.
    There are a fair number of folks with the same problem as you, but as of now, there is no easy answer.

  • Any way to protect table cells? Prevent table modification?

    I have Pages word processing document that contains a two-column label (it's a grading rubric, if you care). The left column labels the data. The right column contains numerical scores and a few cells that sum these up to create subtotals and a grand total.
    Problem: how to protect the cells that should never be edited, such as the four (in this case) which contain formulas?
    Additional problem: I have the left column set to "Return key moves to next cell." This works fine. But, if you accidently press the tab key, you end up creating another column. So, is there a way to protect the structure of the table?
    Thanks,
    James

    There is no way to protect some cells of a table.
    The only feature available is : lock the entire table.
    _Go to "Provide Pages Feedback" in the "Pages" menu_, describe what you wish.
    Then, cross your fingers, and wait _at least_ for iWork'11
    Yvan KOENIG (VALLAURIS, France) mercredi 28 avril 2010 07:44:05

  • How to protect URL with OSSO while leaving sub-URL unprotected

    Hi,
    I have deployed an application to OAS while SSO is enabled and I have the following URL to be protected:
    http://host:port/myContext
    In the myContext application, there is a servlet that I want to be unprotected:
    http://host:port/myContext/myPublic
    I tried two ways to achieve this. One is in mod_osso.conf, create a Location entry like:
    <Location /myContext/>
         require valid-user
         AuthType Basic
    Order deny, allow
         Allow from myPublic
         Satisfy any
    </Location>
    The other way is to create a LocationMatch in mod_osso, like:
    <LocationMatch ^/myContext((?!myPublic).)*$>
    require valid-user
    AuthType Basic
    </LocationMatch>
    The problems with both of these two methods are they seem to break the HTTP server or show down the whole server. I would like to get help on this:
    1. What is the legitimate way to do this: protect a URL while unprotect its sub-page.
    2. In order to protect a new URL, besides adding a Location or LocationMatch , is there something else to do? I don't know why the new entries break/slow down the server.
    Thanks for any help.

    Hi,
    Please refer to this message:
    Re: How to deal with SSO secured webservices
    I tested the described approach and it worked fine for me.
    Best regards,
    IG

  • How do I import Excel cell data in to an already built custom list.

    I have a custom list that we are using as an End Of Shift Report.
    I would like to expand the list to incorporate some of our process data. (We are a paper mill). We have a data historian, PI Process Book, that has an Excel add-in, that allows us to import the process data in to Excel.
    I am able to do the "import spreadsheet" function and get the data in to a new list. What I can't figure out is either how to import directly in to the custom list I have already created, or how to import from the new list to the custom list.
    I could use the "new list" as a container for several different process points if I could figure out how to load the process data in to the custom list.
    We are currently using WSS3, but are upgrading in either the 4th Q this year, or Q1 2014.
    Any other suggestions on how to display single point data (End of Shift Inventory calculations for example) in a custom sharepoint list are welcome.
    I want to take a tank level reading, which we monitor and multiply it by X gallons per foot, then load the total gallons in to the custom list

    1) Open WSS List, and Export it to Excel
    2) Open the Excel file you want to import
    3) Copy the cells in the source and paste them into the Excel file openned from the WSS List (only highlight one row to paste, it will fill down)
    4) You will see vaildation errors (yellow triangles), if there are any, correct them
    5) In the menubar go Data --> List --> Sync List
    6) You will see a blue status bar fill in the bottom left as data is copied up to the List   
    Or you can try the below tools
    > SharePoint Excel Import 2.5
    http://www.boostsolutions.com/sharepoint-excel-import.html
    > Import Excel data to SharePoint List.
    http://spreadsheet2splist.codeplex.com/
    Regards MuSa

  • Protect The Cells in the Excel Sheet Even After giving the password.

    Hi All,
    I need to protect the cells in the report even after unprotecting the sheet after giving password.
    That is, i have used some excel formulas in some cells, these cells are to be protected.
    In Reports using EVDRE all the cells are getting, "Locked" option selected in the Protection tab by default. Even if we change that Option and refresh the sheet Locked is getting selected again.
    So once we Protect the sheet using password all cells are getting locked. But once we remove password all cells are free to enter.
    I want the user of the Sheet to use only certain columns in the Sheet. and all the other columns should not be user editable.
    Please help me out in solving this issue.
    Thanks in Advance,
    Regards,
    G.Vijaya Kumar

    Hi Vijaya,
    I tested in my test environment and even after refresh , the range cells are still editable, they didnt get locked. I did the following:
    1. Selected the range or column in Excel, then Tools - Protection - Allow users to edit range. I selected the range and gave the password.
    2. Next I protected the complete sheet.
    3. Now entire sheet is protected. Now again I selected the range in which I want to edit, first time it will ask for password which you gave for the range. So I gave and I was able to edit the cells.
    4. I selected other cells and was not able to edit it so they are still locked.
    5. I tried to refresh the report , and then I selected the range cells to edit and still I was able to edit it. Those cells didnt get locked.
    So did you do the same things?
    Thanks.

  • How to unfreeze the excel cells

    Dear All,
    Please i haven a file with freeze cells please i need to unfreeze cells urgently please help.
    MS USER

    Hi,
    Check out this one "How to Lock or Unlock Excel cells".
    For more:
    http://office.microsoft.com/en-001/excel-help/lock-or-unlock-specific-areas-of-a-protected-worksheet-HA010096837.aspx
    http://office.microsoft.com/en-001/excel-help/unlock-protected-cells-HA102809343.aspx
    Note: Improve community discussions by marking the answers helpful.
    Thanks
    Clark Kent

  • HT3345 How do I open a password protected excel file created on a PC?  I get a message that the "file is encrypted and can't be opened"

    How do I open a password protected excel file created on a PC in numbers 09, on a MacBook Air?  I get a message that the "file is encrypted and can't be opened"

    This is actually not true; I support users who are doing this w/ Excel 2011 (v14.2.2+) for Mac and Windows users w/ Excel 2003 & 2007.  Win users are from finance dept, and who have pasword-protected various budget files.  The Mac users are (surprise) "creative" users, who enter pw to unlock and edit these budget files.
    These files are shared from a Mac server (running 10.6.8 server), and I do have an erratic problem where all users have read-only access to these pw-protected Excel files.  The manual work-around has been to copy the troublesome file(s) and confirm users have full access again.  I also do a shuffling of filenames, so that the new, working file has original file name.
    FYI: the Mac server POSIX and ACL permissions are correct, and don't appear to be source of the problem.
    It's easy an SMB file-locking issue or concurrent users trying to edit these files.  I keep reminding them that Excel is not a database!

  • How to write to a password protected excel sheet using ActiveX?

    Hi all,
    I would like to write to a protected Excel sheet. I protect the sheet just in case the data is not wrongly programmatically saved to other cells. These cells contained formulas.
    Please help.
    Thanks,
    keng

    Hi Randy,
    Thank you for looking into my problem.
    I have looked into the Workbook.open property node. There is "password" on the property node. Please see attached diagrams.
    Is is the right way to do it?
    Please advise further.
    For your information, the Excel workbook and sheet 1 are password protected.
    Thanks,
    keng
    Attachments:
    Password_Excel.jpg ‏37 KB
    Password_Sheet.jpg ‏23 KB

  • How to get the password of a password protected Excel Sheet using java/jxl

    Hi ,
    how to get the password of a password protected Excel Sheet using java / jxl program.
    plz any one help me .
    Ramesh P
    [email protected]

    If they've implemented the password system correctly there probably isn't a way of getting the password at all.

  • -I have a password protected excel spreadsheet, how can I get my iPads and iPhones to read this and save it password protected?

    I have a password protected excel spreadsheet, how can I get my iPads and iPhones to read this and save it password protected?

    Documents to Go says that it, "Opens password protected Excel 97-2008 files", but does not say whether it can save them as "password protected".
    This might work for you.

  • How to read a passward protected excel file with the help of database connectivity tool kit

    hi, i was reading an excel file with the help of database connectivity tool kit in labview 8.0
    i made tabels in the excel file nand made odbc connection and specified the workbbok name.
    now my problem is how to read the same file if i specife a pasword to that excel file ?

    Hi,
    Check out this thread about opening a password-protected Excel file using ActiveX. This should take care of it for you!
    Amanda Howard
    Americas Services and Support Recruiting Manager
    National Instruments

  • How to synchronize a cell in form with a cell in MS excel sheet

    dear all
    I can successfuly export data to excell using the ole2 package. But the problem is that exporting data from A datablock in a form to Excel sheet is not enough.
    I need to automaticaly copy updates occures on the datablock to its equilivant in the excel sheet. In other words , i need to synchronize my datablock items with facing cells in the excel sheet,so the cells'values in excel sheet automatiacly changes to be the values in the datablock items
    please help

    Dear all
    I can successfuly export data to excell using the ole2 package. But the problem is that exporting data from A datablock in a form to Excel sheet is not enough.
    I need to automaticaly copy updates occures on the datablock to its equilivant in the excel sheet. In other words , I need to synchronize my datablock items with facing cells in the excel sheet,so the cells'values in excel sheet automatiacly changes to be the values in the datablock items
    I searched the web several times . Some people adviced me to use "Apache-jakarta-poi" . It is a pure java code. But my knoledge in java is limited.I asked on Oracle forums -
    how to synchronize a cell in form with a cell in MS excel sheet - but no one can help
    I tried the oracle forms demo "OLEEXCEL.fmb" . But this form is not working correct .
    I need to embed ole2 in my form that holds excel sheet and passes values from text items to the excel sheet.
    My last try is that I did the following :
    1- in the main canvas i insert the OLE2 control
    2- Right Click and choose insert
    3- from the dialog i chosed Excel Sheet
    4- I placed a button on my canvas then i on the button I write this code
    declare
    worksheet ole2.obj_type;
    cell ole2.obj_type;
    args ole2.list_type;
    begin
    forms_ole2.activate_server('block1.excel_sheet');
    worksheet := forms_ole2.get_interface_pointer('block1.excel');
    args := ole2.create_arglist;
    ole2.add_arg(args,1) -- column1
    ole2.add_arg(args,1) -- cell1
    cell := ole2.invoke_obj(worksheet,'cell',args);
    ole2.destroy_arglist(args);
    ole2.set_property('cell','value',:text1);
    ole2.release_obj(cell);
    ole2.release_obj(worksheet);
    end;
    I get this error ora-305500
    and when i debug , the code stop in this line : cell := ole2.invoke_obj(worksheet,'cell',args);
    please help

Maybe you are looking for

  • Whats the difference between these two queries ? - for tuning purpose

    Whats the difference between these two queries ? I have huge amount of data for each table. its takeing such a long time (>5-6hrs). here whice one is fast / do we have any other option there apart from listed here.... QUERY 1:    SELECT  --<< USING I

  • Need BTV code for a JVC LT-42TG30J TV

    Hi everybody, i have tried all the codes listed for the above telly but none of them work :-( Anybody got one of these sets or know of a code that works please BTW its a black BT remote. many thanks Keith. Solved! Go to Solution.

  • Slow writing in Word 2013 to server 2008

    Hi,<o:p></o:p> When Word/Excel writes a NEW file to a win server 2008 it takes about 35 seconds, but to change an old file it takes a second. With the old server 2008 it's quick, with the new server 2008 it's slow. What's the problem?<o:p></o:p> BR/N

  • Hoe do I convert a jsp to an image file?

    Can anybody help me out?

  • Load From Resource Issue

    Hi Friend, I am loading data from LDAP to my SIM using Load from Resource option. But when ever I get users there first name and last name become accountID. I want user uid should accountID in IDM. Can some guru throw some light on it Thx