View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] eric.d.soelberg@gmail.com is offline
external usenet poster
 
Posts: 2
Default Copy rows and insert (x) number of times

I am trying to copy two areas of my spreadsheet and insert those two
areas "X" number of times. I am novice with VBA and tried to take two
strings of code I found on the internet and splice them together, but
to no avail. Here's what I have right now, which is popping up a
prompt asking number of rows, and then it proceeds to copy the two
selections I want and insert them, just like I want it to for ONE
insert. Anyone know how I can get it to insert "X" number of rows
(the number entered into the prompt)?

Here's my current code:

Sub InsertRow()
Dim Rng
Rng = InputBox("How many additional states?")
Range("42:52").Copy
Rows("53").Select
Selection.EntireRow.Insert
Rows("30").Copy
Rows("31").Select
Selection.EntireRow.Insert
Application.CutCopyMode = False
End Sub


Any help is much appreciated!!