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

I need a piece of code to insert into a routine. What I need is for the code
to place a boarder around each cell (column A through T) of the current row.
The curser will not always be in the same cell when the code is run.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default Formating cells

you can give this a try

Sub test()
Dim currow As Long
currow = ActiveCell.Row

With Range("A" & currow & ":T" & currow).Borders(xlEdgeBottom)
.Weight = xlThin
End With

With Range("A" & currow & ":T" & currow).Borders(xlEdgeTop)
.Weight = xlThin
End With

With Range("A" & currow & ":T" & currow).Borders(xlEdgeRight)
.Weight = xlThin
End With

With Range("A" & currow & ":T" & currow).Borders(xlEdgeLeft)
.Weight = xlThin
End With

With Range("A" & currow & ":T" & currow).Borders(xlInsideVertical)
.Weight = xlThin
End With
End Sub


--


Gary


"Patrick Simonds" wrote in message
...
I need a piece of code to insert into a routine. What I need is for the
code to place a boarder around each cell (column A through T) of the
current row. The curser will not always be in the same cell when the code
is run.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Formating cells


Patrick Simonds wrote:
I need a piece of code to insert into a routine. What I need is for the code
to place a boarder around each cell (column A through T) of the current row.
The curser will not always be in the same cell when the code is run.


Sub Macro1()
'
' Macro1 Macro
' Macro recorded 22/11/2006 by Greg Glynn
'
For x = 1 To 20
Cells(ActiveCell.Row, x).Select
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
Next x
End Sub

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
Formating cells Adrian Excel Worksheet Functions 6 May 1st 08 01:34 AM
Formating Cells Nocturnica Excel Worksheet Functions 3 April 25th 08 07:10 PM
conditional formating cells i Excel based on other cells values Elias Petursson Excel Worksheet Functions 3 May 23rd 06 06:45 PM
formating cells Jake in PGH Excel Programming 3 January 18th 06 08:59 AM
Formating cells Kenny M. Excel Programming 2 July 14th 05 02:55 PM


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

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

About Us

"It's about Microsoft Excel"