#### excelNewbie22

##### Active Member
How to Add a certain line after each existing line with numbering?
like let's say this is the lines:

6, 7, 8, 9, 10, 11
12, 13, 14, 15, 16, 17
18, 19, 20, 21, 22, 23

and i want to add after each line the next phrase with a number, like this:
6, 7, 8, 9, 10, 11
New line (#1);
12, 13, 14, 15, 16, 17
New line (#2);
18, 19, 20, 21, 22, 23
New line (#3);

and so on...
can it be done in excel?

#### Joe4

You are welcome!

Note that I re-marked the first reply as the solution, as that has most of the "nuts and bolts" of the code needed (so if anyone in the future was looking for how to do this, that post would be the most helpful). My second post was just a small amendment to the original code.

### Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

#### excelNewbie22

##### Active Member
follow up question, apparentlyi forgot something
is there similar way to add a new cell before the first one which will contain
int[] arr1 = {

cause right now i have all one's=1's

int[] arr1 = {1, 2, 3, 4};
int[] arr1 = {5, 6, 7, 8,};

and i need to incremental all by 1

#### Joe4

follow up question, apparentlyi forgot something
is there similar way to add a new cell before the first one which will contain
int[] arr1 = {

cause right now i have all one's=1's

int[] arr1 = {1, 2, 3, 4};
int[] arr1 = {5, 6, 7, 8,};

and i need to incremental all by 1
I am a little confused by your post, since you are referencing arrays, and we are not using arrays in the code in this thread anywhere.

If you want to simply want to insert the first row above the first entry, see if this does what you want:
VBA Code:
``````Sub MyInsertRows()

Dim lr As Long
Dim i As Long
Dim ctr As Long

Application.ScreenUpdating = False

'   Find last row in column A with data
lr = Cells(Rows.Count, "A").End(xlUp).Row

'   Loop through data
For i = 0 To lr
ctr = ctr + 1
Rows(i * 2 + 1).Insert
Cells(i * 2 + 1, "A") = "New line (#" & ctr & ");"
Next i

Application.ScreenUpdating = True

End Sub``````

#### excelNewbie22

##### Active Member
a friend is doing me a favor in java, since i don't know any code,
so when he stuck with numbering with the above problem he asked me to do it
then give him back the complete file

but i'm asking help from you guys/girls just to know if it was possible to do in excel
(tried googling it, try replace in word and notepad++ and nothing)

for the matter in hand, i need to be able to add a cell in the same line as the numbers and before them
with incremental them by 1, as shown in the example below

before:
1464.xlsx
ABCDEF
1123456
2789101112
גיליון1

after:
1464.xlsx
ABCDEFG
1123456
2int[] arr1 = {123456
3789101112
4int[] arr2 = {789101112
גיליון1

#### Joe4

a friend is doing me a favor in java, since i don't know any code,
so when he stuck with numbering with the above problem he asked me to do it
then give him back the complete file

but i'm asking help from you guys/girls just to know if it was possible to do in excel
(tried googling it, try replace in word and notepad++ and nothing)

for the matter in hand, i need to be able to add a cell in the same line as the numbers and before them
with incremental them by 1, as shown in the example below

before:
1464.xlsx
ABCDEF
1123456
2789101112
גיליון1

after:
1464.xlsx
ABCDEFG
1123456
2int[] arr1 = {123456
3789101112
4int[] arr2 = {789101112
גיליון1
That appears to be quite different than your original question.
So you should post it to a new thread, so it appears as a new, unanswered question, and others will see it too.

#### excelNewbie22

##### Active Member
you are right,
but now i got help with a script in notepad++ and problem solved
next time i'll probaly open a new thread
thanks!

Replies
6
Views
220
Replies
5
Views
120
Replies
6
Views
267
Replies
4
Views
120
Replies
1
Views
106

1,181,589
Messages
5,930,771
Members
436,759
Latest member
grnelson1797

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back