bamaisgreat
Well-known Member
- Joined
- Jan 23, 2012
- Messages
- 831
- Office Version
- 365
- Platform
- Windows
I have the code below that adds a line above the active A cell. Is there a way to change this so it adds the line below the active A cell?
Code:
Sub insertRevBetween()
ActiveSheet.Unprotect
Dim iCountRows As Integer
Dim Rng As Range
iCountRows = 1
'Error Handling
If iCountRows <= 0 Then Exit Sub
If ActiveCell.Row < 9 Then
MsgBox "You Cannot Insert Rows Before Line 9!"
Exit Sub
End If
Set Rng = Range("A" & ActiveCell.Row)
Rng.Resize(iCountRows, 37).EntireRow.Insert
Set Rng = Range("A" & Rng.Row - iCountRows).Resize(iCountRows, 37)
With Rng
.Borders.Weight = xlThin
'.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlEdgeLeft).Weight = xlMedium
'.Borders(xlEdgeTop).Weight = xlThin
End With
Range("B" & ActiveCell.Row - 1).Select
ActiveCell.Copy
Range("B" & ActiveCell.Row + 1).Select
ActiveCell.PasteSpecial xlPasteValues
Range("Ai" & ActiveCell.Row - 1).Copy
Range("Ai" & ActiveCell.Row).PasteSpecial Paste:=xlPasteFormulas
Range("B" & ActiveCell.Row).Select
ActiveSheet.Protect
End Sub