Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Create multiple rows

Sub insert_Rows()
Dim rng As Range, i As Integer, cnt As Integer
Set rng = Cells(Rows.Count, 1).End(xlUp)

For i = rng.Row To 2 Step -1
' Change 2 to 1 if you don't have a header row

cnt = Cells(i, "F").Value
' this is the column with your label count change F to suit

If cnt < 1 Then
Cells(i, 1).EntireRow.Offset(1, 0).Resize(cnt - 1).Insert
Cells(i, 1).EntireRow.Copy Destination:= _
Cells(i, 1).EntireRow.Offset(1, 0).Resize(cnt - 1)
Else
End If
Next
End Sub


On May 1, 11:56 am, T. Neil wrote:
Hi--
Is there a simple way of duplicating a row multiple times based on a value?

For example, I want to create labels in word based on the number of packages
a customer has purchased. Word needs a separate record for each label
produced.
If i have the customer info in a row with the number of labels needed in the
final cell, is there a way of writing a macro to duplicate (either in the
same worksheet or a new one) that would create multiple rows based on the
value in the last cell?

Any advice would be appreciated!



Reply
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
Create multiple rows that follows a series Robin Excel Discussion (Misc queries) 0 August 16th 09 11:25 PM
How to create a macro to delete multiple rows? gak27 Excel Discussion (Misc queries) 4 December 28th 07 04:51 PM
Create multiple copies of rows based on a cell value henryl Excel Programming 2 January 16th 06 02:07 PM
How can I create multiple rows of worksheet tabs in a workbook? kdzugan Excel Discussion (Misc queries) 1 March 8th 05 03:13 PM
create multiple rows using a variable in a cell as source Kevin Stecyk Excel Programming 0 October 24th 03 05:59 AM


All times are GMT +1. The time now is 02:11 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"