Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excellent Ben. Many thanks!
Roddie |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is another possibility
Sub yay() For Each h In ActiveSheet.UsedRange.Cells For i = 5 To 10 If h.Borders(i).Weight < xlThin Then _ h.Borders(i).Weight = xlThin Next Next End Sub -- Regards, Tom Ogilvy "Roddie Grant" wrote in message ... Excellent Ben. Many thanks! Roddie |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ah thanks tom, i always forget that all xl constants also have a numeric twin
"Tom Ogilvy" wrote: Here is another possibility Sub yay() For Each h In ActiveSheet.UsedRange.Cells For i = 5 To 10 If h.Borders(i).Weight < xlThin Then _ h.Borders(i).Weight = xlThin Next Next End Sub -- Regards, Tom Ogilvy "Roddie Grant" wrote in message ... Excellent Ben. Many thanks! Roddie |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many thanks Tom
Roddie "Tom Ogilvy" wrote: Here is another possibility Sub yay() For Each h In ActiveSheet.UsedRange.Cells For i = 5 To 10 If h.Borders(i).Weight < xlThin Then _ h.Borders(i).Weight = xlThin Next Next End Sub -- Regards, Tom Ogilvy "Roddie Grant" wrote in message ... Excellent Ben. Many thanks! Roddie |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do you change the preset borders on the Formating Tool bar? | Excel Discussion (Misc queries) | |||
How can I change the color/type of the borders I put on cells? | Excel Discussion (Misc queries) | |||
How do I change the default color for borders in Excel 2003? | Excel Discussion (Misc queries) | |||
macro that will change the font of a cell if i change a value | Excel Discussion (Misc queries) | |||
Button to change borders | Excel Discussion (Misc queries) |