Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default 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
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



All times are GMT +1. The time now is 10:11 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"