View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default Macro to change cell borders

Sub yay()
For Each h In Sheet1.UsedRange.Cells
If h.Borders(xlDiagonalUp).Weight < xlThin Then
h.Borders(xlDiagonalUp).Weight = xlThin
If h.Borders(xlDiagonalDown).Weight < xlThin Then
h.Borders(xlDiagonalDown).Weight = xlThin
If h.Borders(xlEdgeLeft).Weight < xlThin Then h.Borders(xlEdgeLeft).Weight
= xlThin
If h.Borders(xlEdgeRight).Weight < xlThin Then
h.Borders(xlEdgeRight).Weight = xlThin
If h.Borders(xlEdgeTop).Weight < xlThin Then h.Borders(xlEdgeTop).Weight =
xlThin
If h.Borders(xlEdgeBottom).Weight < xlThin Then
h.Borders(xlEdgeBottom).Weight = xlThin
If h.Borders(xlInsideHorizontal).Weight < xlThin Then
h.Borders(xlInsideHorizontal).Weight = xlThin
If h.Borders(xlInsideVertical).Weight < xlThin Then
h.Borders(xlInsideVertical).Weight = xlThin
Next
End Sub
try that sub i tested it and it worked

"Roddie Grant" wrote:

I have a large number of sheets with thick borders on some cells. I need to
change the borders to thin. It seems to me that this is something which could
be automated with a macro - checking each cell and changing any borders that
exist.

I have written simple macros in the past but this is beating me. Could
someone point me in the right direction.

Thanks