+ Reply to Thread
Results 1 to 6 of 6

Copy Conditional Formatting to multiple range

  1. #1
    Registered User
    Join Date
    05-29-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    4

    Copy Conditional Formatting to multiple range

    I am currently trying to generate a report from a template now. There are multiple conditional formatting applied on the template and I want to copy and apply the conditional formatting to different columns.
    For example,
    The conditional formatting were applied on the template Range("A1:A9")
    The criteria is that if Range("C1") >1, Range("A1") background will become white.
    I wanna apply the same idea, eg. Range("D1") will format depending on Range("F1")'s value, to multiple columns.
    I have tried to copy and pastespecial xlpasteformats to others ranges. It works if I copy and paste format column by column.
    However, there are a few hundred of columns needed to be applied for CF. Copy and Pastespecial column by column will take very long time.
    Instead, I copy the from Range("A1:A9") and paste it to the multiple columns by once, eg Range("D1:D9,G1:G9".....) .
    The problem comes now. The CF are not pasted as I wanted.
    For Range("D1:D9"), the CF depends on the Range("F1:F9") the first column is alright
    For Range("G1:G9"), the CF depends on the Range("F1:F9") the CF for second column should depend on Range("K1:K9") instead.

    If there is any way that I can copy and paste the CF in an efficient way.

  2. #2
    Forum Contributor
    Join Date
    04-23-2013
    Location
    Abu Dhabi United Arab Emirates
    MS-Off Ver
    Excel 2010
    Posts
    178

    Re: Copy Conditional Formatting to multiple range

    Have you tried using Format Painter (brush icon) - this will copy the CF of the source to target range but take note the the $ (absolute Character) in before and after the Column reference must be remove in CF Formatting i.e. $A$1:$A$9 appears in CF remove those $ = A1:A9 then you can select the source cell the click the Format Painter (brush icon) then apply it to the target range

  3. #3
    Registered User
    Join Date
    05-29-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Copy Conditional Formatting to multiple range

    I have tried using the Format Painter. However, since I was copying from a single column and pasting it to multiple non - consecutive columns, the CF are not pasted as how I want them to be.

  4. #4
    Forum Contributor
    Join Date
    04-23-2013
    Location
    Abu Dhabi United Arab Emirates
    MS-Off Ver
    Excel 2010
    Posts
    178

    Re: Copy Conditional Formatting to multiple range

    can you upload sample excel data

  5. #5
    Registered User
    Join Date
    05-29-2013
    Location
    Algeciras, Spain
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Copy Conditional Formatting to multiple range

    Hi there, If I have a conditional formatting using "3 color scale" Format Style, Type "Number" and assigned a value minimum "=$A$1"(GREEN) / Midpoint "percentile=50"(YELLOW) / maximum "=$B$1"(RED) on a cell C1, how can I copy C1 and paste their formats down to C450? If I copy/paste C1 to C2, the reference gets stucked on minimum=$A$1 / Midpoint "percentile=50" / maximum "=$B$1". I tried to remove the dollar sign from it but it gave me an error message " You cannot use relative references in Conditional Formatting criteria for color scales, data bars, and icon sets."
    Last edited by Mondcyte; 05-29-2013 at 04:06 PM. Reason: Office Excel 2010

  6. #6
    Registered User
    Join Date
    05-29-2013
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Copy Conditional Formatting to multiple range

    Oh...it has sorted out. Thanks for all the advise.
    My macro code actually works. It is just that when I check the CF for the cells which were pasted, such as G1, it shows that it is conditioned on F1. But when I change the value of I1, the format changes. So it works as how I want them to be.
    However, I am curious why it still works while the formula in the CF is pointing at a wrong cell.
    Sample.xlsm

    Attached the Sample file. After running the macro "test". It will insert the data from two other worksheets. I then check the CF for the inserted cell. The formulas in the CF are pointing to the wrong cell. However, the CF are still correct for the inserted cell. I am not sure how it happens.
    Last edited by ngkachun01; 05-30-2013 at 03:02 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1