ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format a column from the last row of data on up (https://www.excelbanter.com/excel-programming/389468-format-column-last-row-data-up.html)

MultiMatt

Format a column from the last row of data on up
 
Merjet helped me with a macro to locate some particular data and
delete that row on down, and now I have one final formatting thing I
want to do:

I'd like to place a border around a column from the last row of data
in the worksheet, on up to the top.
The column is "AD".

I'm pretty sure I can figure out the macro to find the last row, but I
don't know how to fit in the code to say "format column "AD" from that
row on up"!!!

Thanks in advance, and thank you Merjet, for helping me with the other
macro!

Matt


Matt[_47_]

Format a column from the last row of data on up
 
Select your range:

Cells(AD1:AD lastrow ).Select


Then this will format whatever you have selected:

Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone


Another suggestion is to do it by hand and record the Macro while
doing it then modify to just select the range.



All times are GMT +1. The time now is 06:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com