Clearing row colour & row data

A

alex1982

Daily Schedule

Coloumn A is a list of names
Coloumn E is a drop down menu with the options of blank, Sick and AL
Coloumns F-AC are 30min time cells

I have a colour counting macro so what ever colour i change a sell to
will count it as 0.5. I have an update button i press to calculate the
hours once i have put in all the different colours. However if i select
the Sick or AL drop down menu after i've done the colours it greys out
the whole line as i want, but if i update again its still counting the
colours that were should before, i guess this has something to do with
the conditional formating. Is it possible get a macro to delete the
data and cell colour so this doesn't happen?

I have attached my spreedsheet so you can see what i mean


+-------------------------------------------------------------------+
|Filename: MASTER 2006.zip |
|Download: http://www.excelforum.com/attachment.php?postid=5246 |
+-------------------------------------------------------------------+
 
B

Bob Phillips

Add this code

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "E26:E72,E74:E87"

On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Target, Range(WS_RANGE)) Is Nothing Then
With Target
For Each cell In .Offset(0, 1).Resize(1, 24)
cell.Interior.ColorIndex = xlColorIndexNone
Next cell
End With
Call Update
End If

ws_exit:
Application.EnableEvents = True
End Sub

This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top