Here is my dilemma. I have an entry in column A. I need this entry duplicates
the amount of times by the number in column b (if column b was 20 would
populate the entry from column A in columns c-v). I have about 50 rows that I
need duplicated and some need to be done 3 times and others 70 times. How can
this be done?
Maybe just a small macro:
Option Explicit
Sub testme()
Dim FirstRow As Long
Dim LastRow As Long
Dim iRow As Long
Dim HowMany As Variant
With Worksheets(quot;sheet1quot;)
FirstRow = 1 'no headers in row 1?
LastRow = .Cells(.Rows.Count, quot;Aquot;).End(xlUp).Row
For iRow = FirstRow To LastRow
'minor validation here
HowMany = .Cells(iRow, quot;Bquot;).Value
If IsNumeric(HowMany) Then
.Cells(iRow, quot;Cquot;).Resize(1, HowMany) = .Cells(iRow, quot;Aquot;).Value
End If
Next iRow
End With
End Sub
If you're new to macros, you may want to read David McRitchie's intro at:
www.mvps.org/dmcritchie/excel/getstarted.htm
gennario wrote:
gt;
gt; Here is my dilemma. I have an entry in column A. I need this entry duplicates
gt; the amount of times by the number in column b (if column b was 20 would
gt; populate the entry from column A in columns c-v). I have about 50 rows that I
gt; need duplicated and some need to be done 3 times and others 70 times. How can
gt; this be done?
--
Dave Peterson
- May 16 Wed 2007 20:37
Duplicate entry quot;xquot; number of times
close
全站熱搜
留言列表
發表留言