Copy just the Locked status of a range to another range?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

As I create the sheet I'm on a macro decides if each cell should be protected or locked within the range of AS21:AU297 ,now i want to copy the each cells property to Range BA21:BC297
however i have very different formatting and conditional formats and even values in these cells that i don't want to lose,

so is there a way i can copy over just the "Protection" status for each cell? i.e Locked or Unlocked??

please help if you can

Thanks

Tony
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi Everyone,

As I create the sheet I'm on a macro decides if each cell should be protected or locked within the range of AS21:AU297 ,now i want to copy the each cells property to Range BA21:BC297
however i have very different formatting and conditional formats and even values in these cells that i don't want to lose,

so is there a way i can copy over just the "Protection" status for each cell? i.e Locked or Unlocked??

please help if you can

Thanks

Tony
Untested. Try this on a copy of your sheet:
VBA Code:
Sub TRY()
Dim c As Range
For Each c In Range("AS21:AU297")
    c.Offset(0, 8).Locked = c.Locked
Next c
MsgBox "Done"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top