View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
isabelle isabelle is offline
external usenet poster
 
Posts: 99
Default Colormarking of fields based on colors in another sheet(difficult !!)

hi Johan,

i do not good understand the conditions for colors (Column M and X till CU), i
hope you could adapt the macro for this part
otherwise, please return here asking for details ...

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
TargetRow = Target.Row
rw = Application.Match(Range("I" & TargetRow), Sheets("Codes").Range("I:I"), 0)

'Step1: The existing filled colored in this sheet in column L and M and X till
CU, to change to 'no color'.
If Target.Column = 12 Then 'column "L"
If Sheets("Data").Range("L" & TargetRow) < "" Then
Sheets("Codes").Range("L" & rw & ":CU" & rw).Copy
Sheets("Data").Range("L" & TargetRow).PasteSpecial Paste:=xlPasteFormats
Application.CutCopyMode = False
Else
Sheets("Data").Range("L" & TargetRow & ":CU" & TargetRow).Interior.Color =
xlNone
'clear the datas in this line (Mx:CUx), if date was cleared ?
End If
Target.Select
Application.EnableEvents = True
End If

'Step2:
If Target.Column = 13 Or (Target.Column = 24 And Target.Column <= 99) Then
'(Column M and X till CU)
datacolor = Sheets("Codes").Cells(rw, Target.Column).Interior.Color
Select Case datacolor
Case 15986394: Target.Interior.Color = 6750054
Case 16777215: Target.Interior.Color = 255
End Select
Application.EnableEvents = True
End If
End Sub

isabelle

Le 2016-10-09 Ã* 01:51, a écrit :
Yes, It works :)

The download link is created. The file is downloadable within 21hrs.
In the file I'd explained my question clear with examples.
It's a bit changed then I'd asked earlier.
Hopely you can help me out. Thanks !

The link has been created:
http://www.cjoint.com/c/FJjfVKxvOEJ

regards,
Johan