I have be trying these routines out and the first two work ok but the third is causing me problems. Also when row(s) are inserted in to the table the zebra stripes are lost, what is the VBA to keep these lines when new ones are inserted?
[pre]
Code:
Sub Insert_Lines_At_Cursor()
Answer = InputBox("How many lines to insert? (20 lines maximum)")
NumLines = Int(Val(Answer))
If NumLines > 20 Then
NumLines = 20
End If
If NumLines = 0 Then
GoTo EndInsertLines
End If
Do
Selection.EntireRow.Insert
Count = Count + 1
Loop While Count < NumLines
EndInsertLines:
End Sub
Next routine
[pre][code]Sub Insert_Lines_At_Cursor2()
On Error Resume Next
ActiveCell.EntireRow.Resize(Int(InputBox("How many lines to insert?"))).Insert
End Sub
[/pre]
Both of the above work but only on the active sheet I have tried the routine below to insert the rows on all work sheets but I am getting this compile/syntax error
For Each ws In ThisWorkbook.Worksheets ws.Activate
Would appreciate some pointers on this. :-
Sub Insert_Lines_At_Cursor3()
Dim ws As Worksheet
Answer = InputBox("How many lines to insert? (20 lines maximum)"

NumLines = Int(Val(Answer))
If NumLines > 20 Then
NumLines = 20
End If
For Each ws In ThisWorkbook.Worksheets ws.Activate
If NumLines = 0 Then
GoTo EndInsertLines
End If
Do
Selection.EntireRow.Insert
Count = Count + 1
Loop While Count < NumLines
EndInsertLines:
End Sub[/code][/pre]