Insert multiple lines with a macro
DADY07
Posted messages
8
Status
Membre
-
Thorgal28 -
Thorgal28 -
Hello, could someone help me!
I would like to insert 10 rows at once using a macro
this macro inserts a single row but how can I make it understand that I need 10 without having to run this macro 10 times
Rows("5:5").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Thank you in advanceConfiguration: Windows XP
Internet Explorer 7.0
I would like to insert 10 rows at once using a macro
this macro inserts a single row but how can I make it understand that I need 10 without having to run this macro 10 times
Rows("5:5").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Thank you in advanceConfiguration: Windows XP
Internet Explorer 7.0
Simplicity... There's nothing better...
Thank you
--
C'est incroyable comme il est plus facile pour une équipe de travailler ensemble, quand personne n'a la moindre idée de où elle va.
I confirm that Eriic's "simple" solution works well.
Sub insertion_10_lignes()
'Inserting 10 rows starting from row 5
Rows("5:15").Insert 'Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
MsgBox "Insertion of 10 rows completed!", vbInformation
End Sub
Note:
Please be careful not to keep your data in "Table" format in Excel (I had this problem at first!).
If that's the case, convert your data back to normal format: Excel Menu>Design>Convert to Range
Then re-run the macro "insertion_10_lignes".