Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UpdateFillOnly
I've written a quick piece of code that updates the FORMATS of any cells
linked to the master cell. I can't attach the small file here, but ... - Precedent is in d3. - The formats of any cells linked to it, d5 and d7 [dependents], are updated by initiating the simple macro below. That was SUPPOSED to be all that was required. But noooooooooooooo ... [!!] The objective NOW is that all cells' formats should be updated EXCEPT any cell that DOES NOT contain a fill color already. Example: The precedent cell d3 is filled yellow, d5 is filled orange, and d7 contains no fill color. D5 should be updated to yellow [or whatever fill is in d3] on running the subroutine, but d7 SHOULD NOT be updated and left as "ColorIndex = xlNone". ** NOTE: The values in the cells will/should update. I thought this would be relatively simple, but ... Below is the subroutine that presently works but is only part of what's required. Follwoing that is last remnant of numerous unsuccessful attempts. Thank you in advance for taking a quick look. .... Any ideas?? Sub UpdateFormat() Selection.Copy Selection.Dependents.Select Selection.PasteSpecial Paste:=xlPasteFormats End Sub 'ONE OF MANY UNSUCCESSFUL ATTEMPTS: 'Dim myCell As Range ' ' Selection.Copy ' Cells.Dependents.Select ' For Each myCell In Selection ' If myCell.Interior.ColorIndex = 1 Then ' Selection.PasteSpecial Paste:=xlPasteFormats ' Else: myCell.Interior.ColorIndex = xlNone ' End If ' Next ' End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|