+ Reply to Thread
Results 1 to 6 of 6

Macro-copy to new sheet with cells still locked

  1. #1
    Registered User
    Join Date
    11-15-2016
    Location
    Albuquerque, NM
    MS-Off Ver
    2016
    Posts
    19

    Macro-copy to new sheet with cells still locked

    Hello,
    I have been working on this macro for a little while.

    Currently:
    Sheet 1 (called 'DO NOT PRINT') has a click-to-run button which checks sheet1, column E, and if column E has any value entered, it copies that entire row to sheet2 (called 'PRINT FORM'), with values and formatting. I have a few random values entered in column E as a test. Column E is where we enter quantity. It's working great so far!

    The piece we are trying to add:
    Sheet1 has most cells locked and only shaded cells can be modified. When they copy to sheet2, sheet2 is all unlocked. Is there a way to use this macro but add a piece that carries over the locked settings?

    The password to the attached 'mock' version is INTEP

    ps. it is an equipment chargeout form we use at an engineering firm to make an invoice for customers for just the equipment they use. The list of equipment isn't infinitely long, but it is always growing. We trust employees to not edit rates and information, but things can be changed accidently, so a locked form is preferable. Any ideas?

    Here is what the Macro says so far:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro-copy to new sheet with cells still locked

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    11-15-2016
    Location
    Albuquerque, NM
    MS-Off Ver
    2016
    Posts
    19

    Re: Macro-copy to new sheet with cells still locked

    I tried this code, but it did not appear to change anything. I can still edit all the cells in sheet2. Any other ideas?

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro-copy to new sheet with cells still locked

    The code just copies the locked properties as you requested. It doesn't password protect the sheet.

    The code below will Unprotect sheet2, copy the rows, and then reprotect sheet2

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-15-2016
    Location
    Albuquerque, NM
    MS-Off Ver
    2016
    Posts
    19

    Re: Macro-copy to new sheet with cells still locked

    Wow! I think this works the way we are hoping! Thank you so much.

    I think I am still unclear on the difference between 'locked' and 'password protected' then. I apologize; my learning has been patchy more than methodical.

    I notice, though, that when I use the code you posted, and try to edit an unshaded cell in sheet2, I get a popup dialogue that this is password protected. Just like magic. Thank you again.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro-copy to new sheet with cells still locked

    You're welcome.

    Think of a cell being Locked\Unlocked as cell specific. Then Protecting the sheet is sheet wide and only the cells that are locked are affected.

+ 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. Allow copy and paste cells if they are locked.
    By Immortal2014 in forum Excel General
    Replies: 4
    Last Post: 12-23-2015, 07:45 AM
  2. Replies: 2
    Last Post: 12-17-2015, 12:33 PM
  3. Locked sheet with unlocked cells Spell Check Macro
    By jodi roy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-15-2014, 03:40 PM
  4. Replies: 3
    Last Post: 07-26-2014, 06:12 AM
  5. Copy and paste locked cells, and have pasted cells retain LOCKED status.
    By stratloveslenny in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2014, 03:05 PM
  6. Replies: 3
    Last Post: 04-12-2014, 04:47 AM
  7. Replies: 1
    Last Post: 03-29-2014, 09:56 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