ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Borders with Macros (https://www.excelbanter.com/excel-programming/334860-borders-macros.html)

waynehinds[_2_]

Borders with Macros
 

I would like to put a border around data using a macro. In some cases
may need to border A1:AC44 and in other cases it may be A1:AC45. In al
cases the A1 is static and AC is static but the row is determined b
where the field 'Grand Total' is located.

How do i create a relative reference to put a border around thi
information

--
waynehind
-----------------------------------------------------------------------
waynehinds's Profile: http://www.excelforum.com/member.php...fo&userid=2533
View this thread: http://www.excelforum.com/showthread.php?threadid=38811


STEVE BELL

Borders with Macros
 
Check these out

MsgBox ActiveSheet.UsedRange.Address
=============================
Dim LASTROW As Integer, rng as Range

LASTROW = Cells(Rows.COUNT, "A").End(xlUp).Row
set rng = Range("A1:AC" & LASTROW)
--
steveB

Remove "AYN" from email to respond
"waynehinds" wrote
in message ...

I would like to put a border around data using a macro. In some cases I
may need to border A1:AC44 and in other cases it may be A1:AC45. In all
cases the A1 is static and AC is static but the row is determined by
where the field 'Grand Total' is located.

How do i create a relative reference to put a border around this
information.


--
waynehinds
------------------------------------------------------------------------
waynehinds's Profile:
http://www.excelforum.com/member.php...o&userid=25331
View this thread: http://www.excelforum.com/showthread...hreadid=388111




waynehinds[_3_]

Borders with Macros
 

Thanks for advice. That statement worked fine.

What if I wanted to put a different outline starting with the row belo
it.

For example I search for Grand Total and in the row below that an
always in column s i want to outline five boxes

--
waynehind
-----------------------------------------------------------------------
waynehinds's Profile: http://www.excelforum.com/member.php...fo&userid=2533
View this thread: http://www.excelforum.com/showthread.php?threadid=38811


STEVE BELL

Borders with Macros
 
Just add 1

LASTROW = Cells(Rows.COUNT, "A").End(xlUp).Row+1
set rng = Range("A1:AC" & LASTROW)

or
LASTROW = Cells(Rows.COUNT, "A").End(xlUp).Offset(1, 0).Row
set rng = Range("A1:AC" & LASTROW)

Glad it worked!!!
--
steveB

Remove "AYN" from email to respond
"waynehinds" wrote
in message ...

Thanks for advice. That statement worked fine.

What if I wanted to put a different outline starting with the row below
it.

For example I search for Grand Total and in the row below that and
always in column s i want to outline five boxes.


--
waynehinds
------------------------------------------------------------------------
waynehinds's Profile:
http://www.excelforum.com/member.php...o&userid=25331
View this thread: http://www.excelforum.com/showthread...hreadid=388111





All times are GMT +1. The time now is 03:35 AM.

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