hello, I need to insert eg 2 rows, skip one, add 2 rows, skip one, etc.
For example:
insert new rows in the A2 and A3, again in A5 and A6, again in A8 and A9, etc.
It must be the entire row, not just A column.
I hope one of you good people who can give me a good tip.
sincerely,
Hans N.![]()
Last edited by 2hans; 08-21-2011 at 09:09 AM.
the sample sheet (though trivial) is like this from A1 in sheet 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
copy sheet 1 to sheet 2 also
now try this macro test
Sub test() Dim j As Integer Worksheets("sheet1").Activate j = 2 Do Range(Cells(j, 1), Cells(j + 1, 1)).EntireRow.Insert j = j + 3 If Cells(j, 1) = "" Then Exit Do Loop End Sub
Sub undo() Worksheets("sheet1").Cells.Clear Worksheets("sheet2").Cells.Copy Worksheets("sheet1").Range("A1") End Sub
Hi venkat1926
Thx for your great help, this was what I needed. I removed the line "worksheet" I now it works vere nice.
Sub test()
Dim j As Integer
j = 2
Do
Range(Cells(j, 1), Cells(j + 1, 1)).EntireRow.Insert
j = j + 3
If Cells(j, 1) = "" Then Exit Do
Loop
End Sub
Thx for help.
Kinds regards
Hans N
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks