Conditional Formatting multiple tables the same way - VBA

choop

New Member
Joined
Oct 21, 2005
Messages
21
Hello,

I have a spreadsheet with about 7 identical (same headings, columns) tables. Those 7 tables are lists of employees for each of our seven plants. In addition to employee names, it includes a bunch of detail about job, manager, etc.

I have about 8 or 10 conditional formattings that I would like to use, but i'm finding that Excel gets very confused when I copy and paste data between tabs, or add new rows.

I would like to have a macro that can cycle through each of the tabs, clear all conditional formatting, and then re-apply my pre-defined conditional formatting. The trick is that the number of rows isn't the same between the tables, so ranges aren't a good option, the code would really need to apply to the table.Column itself so it dynamically incorporates all data, while leaving blank rows as regular formatting.

Tables:
Plant1​
Plant2​
etc...​

Columns include:
Site​
Baseline Employee​
EE Number​
SEGMENT​
Role Origination Date​
IN WORKDAY?​
Manager Name​
Shift​
Workday Title​
Simplifed Business Title​
Title-Shift​
B/V/SGA​
Comment​
January​
February​
March​
April​
May​
June​
July​
August​
September​
October​
November​
December​

Is this possible?

thanks
 
To get the whole table you can use
VBA Code:
With ws.ListObjects(1)
   .Range.FormatConditions.Delete
   Sheet22.ListObjects(1).DataBodyRange.Copy
   .DataBodyRange.PasteSpecial xlPasteFormats
End With
But if you have CF rules, outside this range, they may still exists.
 
Upvote 0

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,214,864
Messages
6,121,981
Members
449,058
Latest member
oculus

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