Ashley1432
New Member
- Joined
- Aug 10, 2017
- Messages
- 8
I have the following macro that goes through different tabs of my workbook and inserts a specific number of rows starting in A13 in each tab based on the value in B1. I need to make a separate macro that basically deletes these lines back out later. Can someone help me to modify the below to delete out the lines that this macro has inserted?
Sub InsertRows()
Dim ws As Worksheet
Dim insRow As Long
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
insRow = ws.Range("B1").Value
If insRow > 0 Then
ws.Range("A13").Resize(insRow, 1).EntireRow.Insert Shift:=xlDown
ws.Range("A12:E12").Copy Destination:=ws.Range("A13").Resize(insRow, 5)
End If
Next ws
Application.ScreenUpdating = True
End Sub
Sub InsertRows()
Dim ws As Worksheet
Dim insRow As Long
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
insRow = ws.Range("B1").Value
If insRow > 0 Then
ws.Range("A13").Resize(insRow, 1).EntireRow.Insert Shift:=xlDown
ws.Range("A12:E12").Copy Destination:=ws.Range("A13").Resize(insRow, 5)
End If
Next ws
Application.ScreenUpdating = True
End Sub