LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
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!!
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy a worksheet to new one with repeat rows 5 times mfn Excel Discussion (Misc queries) 0 February 13th 08 11:33 AM
Duplicate rows a given number of times in Excel? SB Excel Programming 3 February 8th 08 12:07 AM
Macro to copy exactly the I number of times that he/she appears in the column Israel[_2_] Excel Programming 1 March 17th 07 10:15 AM
how do i copy down x number of times Frazer Edwards Excel Worksheet Functions 1 July 6th 06 10:43 PM
Copy a formula down a set number of times Julian Excel Worksheet Functions 1 September 23rd 05 06:43 PM


All times are GMT +1. The time now is 10:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"