MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Still adding rows..but different


Posted by Malaun koko on August 02, 2001 9:55 PM

Thanks a bunch Cory..curious about one thing..could you
make it add the row automatically when the 3 cell
filled..thanks again
cell, then the cell next to it, and finally the cell two over. If all three have data in them, then it adds the
row with borders...:


Posted by Cory on August 03, 2001 10:53 AM

Whew! A little more difficult than just pushing a button, but I got it to work... If you need any adjustments made, not them and email me or post them. Here it is (notice WHERE this code goes...):

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo error1
If ActiveCell.Column = 3 Then
If ActiveCell.Offset(-1, 0).Value > "" Then
' Application.ScreenUpdating = False
Range(Selection, Selection.End(xlToLeft)).Select
If ActiveCell.Column = 2 Then
ActiveCell.Offset(0, 1).Select
Exit Sub
Else
Range(Selection, Selection.End(xlToLeft)).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
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
ActiveCell.Select
' Application.ScreenUpdating = True
Exit Sub
End If
Exit Sub
End If
Exit Sub
End If
Exit Sub
error1: Exit Sub
End Sub


Cory