Formatting a Dynamic Bottom Row

mykulpasskwa

Board Regular
Joined
Mar 20, 2018
Messages
66
I have a range B5:R8, and there is command button that inserts a row where at the active cell. I've figured out how to preserve the formatting for the top row B5:R5 but I can't figure out how to format the bottom properly. Currently if you select the last row (R8) and Insert Row, a thick outline of the bottom most border makes its way inside the range.

I tried to do a dynamic defined name, but even if the cells are empty I want the formatting contained in that range to maintain the borders they are supposed to have.

So ultimately, if the range is B5:R8 then all the cells inside should be thin borders, and the edges should be medium borders.
Then if a user inserts a row anywhere the range become B5:R9
If that inserted row happens to be at the bottom, then the previously bottom row should change to a bottom border.
Now that I typed it out that way, I'm wondering if this is some sort of If statement? Any thoughts?


SmBLG0P.png
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Use a Table instead. A formatted table automatically extends its range and formatting as data is entered.
 
Upvote 0
I agree. Using Tables is a great way to do this:

1.Select your current Range
2.On the Ribbon select Insert Table

Presto
 
Upvote 0
Thanks for the reply. I have tried changing it over to a table and I've created a custom format for the table, however is it possible to format a particular column. As you'll see in the picture columns J and R are orange, so I would like to keep them visually distinct and as one table. That doesn't seem possible with the custom table format option, but then again this is the first time I've attempted it.
 
Upvote 0
I mentioned doing things this way:
1.Select your current formatted range
2. Select insert Table
3. Now if your last row in the range is row 6 and you enter a new value in row 7 the formatting will now extend down to row 7

No need to insert row and no need for custom formatted Table

But you never mentioned if you even tried this.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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