Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
S30 via OfficeKB.com
 
Posts: n/a
Default Finding Unlocked cells in Excel

Hi All,

I have a macro which find and adds color to all unlocked/unprotected cells in
Excel. Unfortunately once I remove the color from unlocked cells the macro
also removes original colors applied to the cells prior to running these
macros.

Any ideas of how I could improve these macros?

Thanks a lot in advance

Steve

Sub Color_Unprotected_cells()
Application.ScreenUpdating = False
Set A = ActiveWorkbook.ActiveSheet
For Each Sheet In ActiveWorkbook.Worksheets
Sheet.Activate
Sheet.Cells.Select
For Each Item In Intersect(ActiveSheet.UsedRange, Selection.Cells)

'Item.Value = Item.Interior.ColorIndex
If Item.Locked = False Then
Item.Interior.ColorIndex = 37
End If
Next
ActiveSheet.Range("A1").Select
Next Sheet
A.Activate
Application.ScreenUpdating = True
End Sub

Sub Remove_Color_Unprotected_cells()
Application.ScreenUpdating = False
Set A = ActiveWorkbook.ActiveSheet
For Each Sheet In ActiveWorkbook.Worksheets
Sheet.Activate
ActiveSheet.Cells.Select
For Each Item In Intersect(ActiveSheet.UsedRange, Selection.Cells)
If Item.Locked = False Then
Item.Interior.ColorIndex = xlNone
End If
Next
ActiveSheet.Range("A1").Select
Next Sheet
A.Activate
Application.ScreenUpdating = True
End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200604/1
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking Groups of cells between workbooks vnacj-joe Excel Discussion (Misc queries) 4 June 14th 07 05:18 PM
Excel truncated my cells when copying, how to avoid?? bxc2739 Excel Discussion (Misc queries) 0 March 17th 06 04:40 PM
Maintain proper links when Excel cells are moved Excelnovice Excel Discussion (Misc queries) 0 February 19th 06 06:17 PM
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER MEGTOM New Users to Excel 5 October 27th 05 03:06 AM
Merging cells in Excel 2003 Bob Excel Discussion (Misc queries) 1 October 19th 05 07:10 PM


All times are GMT +1. The time now is 11:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"