Thread: cell shading
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default cell shading

Try this macro

Sub ClearColoredCells()
Dim c As Range, ClrVal
Application.InputBox("Select one of the cells to be cleared", Type:=8).Select
ClrVal = Selection.Interior.ColorIndex
ActiveSheet.UsedRange.Select
For Each c In Selection
If c.Interior.ColorIndex = ClrVal Then
c.ClearContents
End If
Next c
End Sub

It pauses & asks you to select any one of the shaded cells to be cleared.
Then it clears all the cells with that same interior fill color.

Hope this helps,

Hutch

"dunny_budgie" wrote:

Is there a way to automatically reset the value of all cells in a spreasheet
that have been shaded a specific colour?

In my spreadsheet I have (for ease of use) shaded yellow all the cells that
the user can input data into. Anything not shaded yellow is protected and
unavailable to the user. What i want to do is clear all the user inputs at
the end of each month, so that at the start of the following month they can
re-use the spreadsheet.

Can this be done? i could not find anything in VBA, but there must be
something.

Any help is appreciated!