Friends,
Please, can someone tell me what's wrong with this code of mine?
Here's the code...
Sub InsertLines()
Dim LinNum As Long
While LinNum <= 0
On Error GoTo Exit
LinNum = InputBox("Type the number of lines you wish to INSERT:")
Wend
Sheets(Array("RCI28", "RCI56", "RCI84")).Select
Sheets("RCI28").Activate
Range("A22").End(xlDown).Select
Range(Selection, Selection.Offset(LinNum - 1, 0)).Select
Selection.EntireRow.Insert Shift:=xlDown
Range("A22").EntireRow.Select
Selection.Copy
Range("A22").End(xlDown).Select
Range(Selection, Selection.End(xlDown)).EntireRow.Select
ActiveSheet.Paste
Application.CutCopyMode = False
Calculate
Range("A1").Select
Exit:
End Sub
I have three sheets (RCI24, RCI56 and RCI84) and I want to insert lines for these three sheets at the same time. When I do it manually it works pretty well, but when I run this code, it doesn't work the way it should do.
Manually, I select the three sheets, activate one of them and insert the lines. It works fine for the three sheets.
With this code, Excel inserts the rows in "active sheet" only. Do I have to activate sheets, one by one, and repeat the code two more times, one for each sheet? The way the code is now isn't the same syntax of the manually procedure?
Thanks for you attention, guys.
Hugs. 
Bruno
Bookmarks