Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Borders around cells...


I do not know how to word my problem so let me explain the process...

From an access DB a user pushes a button then an excel document is
built and populated using the excel object. The formatting is done
automatically (I recorded a macro and edited the code). Columns A:G
are
selected then the border is placed down the entire columns.

I would like to format the .xls document better. How can I limit the
border to where the borders stop on the last row of data on the .xls
doc?

Any ideas or tips will be greatly appreciated.


--
syuhas
------------------------------------------------------------------------
syuhas's Profile: http://www.excelforum.com/member.php...o&userid=27486
View this thread: http://www.excelforum.com/showthread...hreadid=517364

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Borders around cells...

Possibly

Sub DoBorders()
Dim rng As Range
With ActiveSheet
Set rng = Intersect(.Columns("A:M"), .UsedRange)
End With
With rng
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Borders(xlEdgeTop).LineStyle = xlNone
.Borders(xlEdgeBottom).LineStyle = xlNone
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Borders(xlInsideHorizontal).LineStyle _
= xlNone
End With
End Sub


Adjust to suit what you are actually doing and the columns you want to
address.

The above just puts borders on the vertical edges, but can be adjusted to
whatever you want.

--
Regards,
Tom Ogilvy

"syuhas" wrote in
message ...

I do not know how to word my problem so let me explain the process...

From an access DB a user pushes a button then an excel document is
built and populated using the excel object. The formatting is done
automatically (I recorded a macro and edited the code). Columns A:G
are
selected then the border is placed down the entire columns.

I would like to format the .xls document better. How can I limit the
border to where the borders stop on the last row of data on the .xls
doc?

Any ideas or tips will be greatly appreciated.


--
syuhas
------------------------------------------------------------------------
syuhas's Profile:

http://www.excelforum.com/member.php...o&userid=27486
View this thread: http://www.excelforum.com/showthread...hreadid=517364



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
printing cells with borders Jackie D Excel Discussion (Misc queries) 2 July 23rd 06 03:18 PM
Borders Don't Line up with Cells. Michael Hesse Excel Discussion (Misc queries) 0 August 30th 05 04:08 PM
Borders around cells Michelle Excel Programming 1 June 30th 04 06:33 PM
HELP! Merge cells and borders.... Maly Excel Programming 2 July 30th 03 02:38 AM


All times are GMT +1. The time now is 11:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"