A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Programming
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

VB to insert duplicate rows based on value in other row



 
 
Thread Tools Display Modes
  #1  
Old July 20th 12, 12:00 AM posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VB to insert duplicate rows based on value in other row

Hello all -

I would like something that automatically duplicates a pre-formatted row 11 based on the value in E7.

For example, if I enter "24" in E7, I would like Row 11 duplicated so it appears 24 times, beginning with Row 11. ROWS 1-10 have header and project information.

Any help would be greatly appreciated.
Ads
  #2  
Old July 20th 12, 08:06 AM posted to microsoft.public.excel.programming
Auric__
external usenet poster
 
Posts: 304
Default VB to insert duplicate rows based on value in other row

bjclux wrote:

> I would like something that automatically duplicates a pre-formatted row
> 11 based on the value in E7.
>
> For example, if I enter "24" in E7, I would like Row 11 duplicated so it
> appears 24 times, beginning with Row 11. ROWS 1-10 have header and
> project information.


Try this:

Sub duplicateNtimes()
Dim v As Variant, L0 As Long
v = Cells(7, 5).Value
If IsNumeric(v) Then
Rows(11).Copy
For L0 = 2 To v
ActiveSheet.Paste Destination:=Cells(10 + L0, 1)
Next
Application.CutCopyMode = False
End If
End Sub

--
Tell 'em Large Marge sent ya!
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert cells based on duplicate entries Versace77 Excel Programming 8 March 2nd 09 06:13 PM
Duplicate Rows Based On Cell Value? [email protected] Excel Programming 2 June 20th 08 05:29 PM
Automatically Duplicate Rows based on Volume. Matt.Russett Excel Worksheet Functions 0 June 18th 08 09:22 PM
Convert Columns to Rows based upon a duplicate value EJR Excel Programming 3 December 31st 07 07:54 PM
Insert duplicate rows based on numeric value in column Nu2Excel Excel Discussion (Misc queries) 2 September 24th 05 04:31 PM


All times are GMT +1. The time now is 11:18 AM.


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