• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

change macro for excel2007

max_max

New Member
Hi to all,
it's possibile chande this macro for excel2007?

Code:
Sub fixCF_Formatting()
    On Error Resume Next
    Dim CF_range As Range
    Set CF_range = ActiveSheet.Cells.SpecialCells(xlCellTypeAllFormatConditions)
    On Error GoTo 0
    If Not CF_range Is Nothing Then
    Application.ScreenUpdating = False
    Dim cell As Range
    For Each cell In CF_range
        If cell.Interior.Color <> cell.DisplayFormat.Interior.Color Then _
                        cell.Interior.Color = cell.DisplayFormat.Interior.Color
    Next cell
    ' remove the CF if desired
    CF_range.FormatConditions.Delete
    End If
End Sub

this part not work for excel 2007

Code:
If cell.Interior.Color <> cell.DisplayFormat.Interior.Color Then _
                        cell.Interior.Color = cell.DisplayFormat.Interior.Color
thank you
max
 
Last edited by a moderator:
max_max
Please, reread and follow Forum Rules:
  • Cross-Posting. Generally, it is considered poor practice to cross post. That is to post the same question on several forums in the hope of getting a response quicker.
  • If you do cross-post, please put that in your post.
  • Also if you have cross-posted and get an Solution elsewhere, have the courtesy of posting the Solution here so other readers can learn from the answer also, as well as stopping people wasting their time on your answered question.
 
max_max
Moderator note:
Did You read that underlined sentence?
If You did - then You should do something
If You skipped it - then You should read it and do as it has written.
 
I found this macro in the forum

Code:
Sub blah()
Set srce = Range("BY11:CV20")
Set destn = Range("AC11:AZ20")
For rw = 1 To srce.Rows.Count
  For clm = 1 To srce.Columns.Count
    destn.Cells(rw, clm).Interior.Color = srce.Cells(rw, clm).DisplayFormat.Interior.Color
  Next clm
Next rw
End Sub

but it doesn't work here
destn.Cells(rw, clm).Interior.Color = srce.Cells(rw, clm).DisplayFormat.Interior.Color
 
You cannot use DisplayFormat in 2007 as it was only added in 2010. To access conditional formatting colours in 2007 is much, much more involved. Chip's page here will give you an idea of what is involved (for simple colour formatting at least).
 
Back
Top