VBA to create a list of all unlocked cells

Arie Bos

Board Regular
Joined
Mar 25, 2016
Messages
224
Office Version
  1. 365
Platform
  1. Windows
Hello Excelleers,

I would like to create a list of all unlocked cells to easier keep track of them. Or, alternatively, a code that lightens up every unlocked cell, until next keypress.
I like to avoid conditional formatting, as it slows down the sheet and I only want it during building the workbook.
I thought his topic would already exist, as it seems handy if one could put such a code in any workbook, but I could not find it in the forum.

Many thanks,
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi,
one idea maybe?

VBA Code:
Sub UnLockedCells()
    Dim cell As Range
    For Each cell In ActiveSheet.UsedRange.Cells
        cell.Interior.Color = IIf(Not cell.Locked, vbYellow, xlNone)
    Next cell
End Sub

Dave
 
Upvote 0
Solution
Thanks Dave, that was quick!. it works nice. I have made two cons in the quick access toolbar with one for this code, and one to bring it all back to no color.
Works perfect, thanks again.
Arie
 
Upvote 0
Thanks Dave, that was quick!. it works nice. I have made two cons in the quick access toolbar with one for this code, and one to bring it all back to no color.
Works perfect, thanks again.
Arie

code should return to no colour if cell state = locked

Glad solution helps

Dave
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,214
Members
449,074
Latest member
cancansova

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