Get Border Range

sheen

New Member
Joined
Sep 14, 2006
Messages
3
Hi,

I have more than one data tables on a sheet, each with a border. I want to write a macro that colors all these tables. For this i need, to get the range with borders. Is there any way to do this?

Thanks!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
To select an entire table in code, do this:

1. Select the cell
2. Activecell.CurrentRegion.Select

If you want the table's background to be yellow, try
ActiveCell.CurrentRegion.Interior.ColorIndex=6

Denis
 
Upvote 0
Select all the cells in one table at a time, then name the range:

Excel Toolbar: Insert - Name - Define...
Then in the top box add the name you want to give that table.

Now you can refer to the collection of cells in that table by its name. If the table changes in size the name will automatically refer to all the cells in that table.

You will need to color the range using VBA Event code. So, if say the value of a cell changes value, then that value will trigger what color the table gets. Or you can use, some other trigger or condition to color that table. This has been done many times on this board, use the "Search" utility at the top right of this board to search for code samples.
 
Upvote 0

Forum statistics

Threads
1,214,825
Messages
6,121,788
Members
449,049
Latest member
greyangel23

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