Copy/pasting Conditional Formatting to new rows?

BadSpreadsheet

New Member
Joined
Jul 13, 2022
Messages
3
Office Version
  1. 2019
Platform
  1. Windows
Hello,

I have a regular table of numbers and have manually selected the top left most cell (first column/first row) and every second cell along that first row (by holding down the CTRL key) after which I applied one of the simple preset colour gradient Conditional Formats to. Consider this manually formatted row as the row that contains the "seed" formatting rule I want to now easily somehow copy/paste down through the rest of the table without having to manually select each cell (by holding down CTRL) in each row and then manually applying the CF like I did in the "seed".

CF example AliGW (1).xlsx
BCDEFGHIJKLMNOPQ
25977722184321418387623639295990873753341770112
34021221011586931862260767125402919733273718430
411318151000691275636313485174201371230481984190
51948604465233158353880785619097893795975743916
698524695830814566263580650656573330554557265676
76205811015914888386739410680697556629645827688
8740387685554120174503322115585862819842577234451
9242747697193536775512295753549124618340782338
1045421821213729613114190370349651790892755116570
11845677255869426268434557221485667203187741689118
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B2,D2,F2,H2,J2,L2,N2,P2Other TypeColor scaleNO


Note that the standard "copy/paste" methods I have tried do not result in the desired outcome. It will apply the CF to the correct cells of course, but instead of creating a separate independent version of the same CF rule for each row, it will just add new cells to the range of cells the original "seed" CF applies to, so the one colour gradient CF rule considers ALL the cells, rather than the CF rule just applying to the set of numbers in each row individually.

In other words, if I simply copy/paste the formatting from the original rule to the other rows, Excel adds those new cells to the selection of cells to which the Conditional Formatting applies, rather than copying the new rule and applying it separately to the new row of numbers. This can all be verified in the CF Manager screen when

How do I copy the Conditional Formatting from Row 1 down the table so that new rules are created for each row being formatted, rather than just adding the cells from each row to the original rule?

Thanks

BadSpreadsheet
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
BadSpreadsheet.xlsm
BCDEFGHIJKLMNOPQ
25977722184321418387623639295990873753341770112
34021221011586931862260767125402919733273718430
411318151000691275636313485174201371230481984190
51948604465233158353880785619097893795975743916
698524695830814566263580650656573330554557265676
76205811015914888386739410680697556629645827688
8740387685554120174503322115585862819842577234451
9242747697193536775512295753549124618340782338
1045421821213729613114190370349651790892755116570
11845677255869426268434557221485667203187741689118
CF

Welcome to the MrExcel board!

Is this more what you are looking for?
If so, about how many rows is your actual range?
 
Upvote 0
BadSpreadsheet.xlsm
BCDEFGHIJKLMNOPQ
25977722184321418387623639295990873753341770112
34021221011586931862260767125402919733273718430
411318151000691275636313485174201371230481984190
51948604465233158353880785619097893795975743916
698524695830814566263580650656573330554557265676
76205811015914888386739410680697556629645827688
8740387685554120174503322115585862819842577234451
9242747697193536775512295753549124618340782338
1045421821213729613114190370349651790892755116570
11845677255869426268434557221485667203187741689118
CF

Welcome to the MrExcel board!

Is this more what you are looking for?
If so, about how many rows is your actual range?
That is exactly what I want to do!....but not by repeating what I did to create the first row example....ie. not manually clicking on every second cell in each row, applying the CF, then repeating for the next row etc etc etc

How did you apply the CF to each row?

My actual range could have 100's of rows and up to 100 columns.
 
Upvote 0
How did you apply the CF to each row?
I did it like this, but still quite a task if your have hundreds of rows and columns
  1. Select B2:Q2
  2. Apply color-scale CF. I used the first one in the list:
    1657855056183.png
  3. Double-click the Format Painter to activate it
  4. Individually click on B3, B4, B5, ..., B11 - thus applying the same formatting rules individually to each row.
  5. Click Format Painter again to deactivate it
  6. Select columns C, E, G, ...., Q by clicking their heading labels (with Ctrl button held after selecting the first column)
  7. Conditional Formatting -> Clear Rules -> Clear Rules from Selected Cells

Since you have many more rows and columns, the above process could be accomplished more easily with a macro like this.
I have assumed that there is no Conditional Formatting already in place in the range.

VBA Code:
Sub CFSpecial()
  Dim rng As Range, rw As Range
  Dim i As Long
 
  Set rng = Range("B2", Range("B" & Rows.Count).End(xlUp)).Resize(, Cells(2, Columns.Count).End(xlToLeft).Column - 1)
  Application.ScreenUpdating = False
  For Each rw In rng.Rows
      rw.FormatConditions.AddColorScale ColorScaleType:=3
      With rw.FormatConditions(1)
        .ColorScaleCriteria(1).Type = xlConditionValueLowestValue
        .ColorScaleCriteria(1).FormatColor.Color = 7039480
        .ColorScaleCriteria(2).Type = xlConditionValuePercentile
        .ColorScaleCriteria(2).Value = 50
        .ColorScaleCriteria(2).FormatColor.Color = 8711167
        .ColorScaleCriteria(3).Type = xlConditionValueHighestValue
        .ColorScaleCriteria(3).FormatColor.Color = 8109667
      End With
  Next rw
  For i = 2 To rng.Columns.Count Step 2
    rng.Columns(i).FormatConditions.Delete
  Next i
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
You're welcome. Thanks for the follow-up. :)

I don't know if that was a one-off job for you and now done, but here is another way where you don't have to do steps 6 & 7 above.
Apply these two CF rules (one color scale and one formula rule) to B2:Q2 making sure that they are showing in the correct order and that 'Stop if True' is checked on the first one.
Then just do the Format Painter thing row-by-row.

1657933314579.png
 
Upvote 0

Forum statistics

Threads
1,215,157
Messages
6,123,341
Members
449,097
Latest member
thnirmitha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top