Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I compiled a macro using the macro recorder to put borders around a
selection of cells. However, I'm getting the following error when I do two cells. Run-Time Error '1004': Unable to set the LineStyle property of the Border class. I know why this happens as well but not sure what to do to fix it. Here is the VBA code for it: Sub borders() ' ' borders Macro ' Macro recorded 24/08/2004 by Steven North ' ' Keyboard Shortcut: Ctrl+Shift+B ' 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 With Selection.borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = 48 End With With Selection.borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlHairline .ColorIndex = 15 End With End Sub Is it possible to do an If statement i.e. IF ISERROR(With Selection.border(xlInsideVertical)) Then NEXT WITH ELSE CONTINUE END WITH ???? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Border | Excel Discussion (Misc queries) | |||
border on last cell of page effects border on beginning cell of ne | Excel Discussion (Misc queries) | |||
border | Excel Worksheet Functions | |||
Πως μπορώ να συγκρίνω αν 2 κυψέλες έχουν το ίδιο border | Excel Discussion (Misc queries) | |||
Changing the border of one cell s/n change the border of adjacent | Excel Discussion (Misc queries) |