cjohnson0181
New Member
- Joined
- Mar 29, 2018
- Messages
- 9
All, I have started a code that inserts n-number of rows below based on a dialog box. Now I want to format all of the rows added with all thin borders and then thick outside borders. Any help would be GREATLY appreciated as I am under a time crunch!
Code:
Sub insertMultipleRows()
Dim iCountRows As Integer
iCountRows = Application.InputBox(Prompt:="How many rows do you want to add? Starting with row " _
& ActiveCell.Row & "?", Type:=1)
'Error Handling
If iCountRows <= 0 Then End
If ActiveCell.Row < 9 Then
MsgBox "You Cannot Insert Rows Before Line 9, Dummy!"
Else
'Based on number of rows specified, inser these rows
Rows(ActiveCell.Row & ":" & ActiveCell.Row + iCountRows - 1).Insert shift:=xlDown
'Formatting
With ActiveCell.Columns("A:AG").Select
Selection.Borders.Weight = xlThin
ActiveCell.Columns("A:AG").Select
Selection.Borders(xlEdgeBottom).Weight = xlMedium
ActiveCell.Columns("A:AG").Select
Selection.Borders(xlEdgeTop).Weight = xlMedium
ActiveCell.Columns("A:AG").Select
Selection.Borders(xlEdgeRight).Weight = xlMedium
End With
End If
End Sub