Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
gennario
 
Posts: n/a
Default Duplicate entry "x" number of times

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?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Duplicate entry "x" number of times

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("sheet1")
FirstRow = 1 'no headers in row 1?
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row

For iRow = FirstRow To LastRow
'minor validation here
HowMany = .Cells(iRow, "B").Value
If IsNumeric(HowMany) Then
.Cells(iRow, "C").Resize(1, HowMany) = .Cells(iRow, "A").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:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

gennario wrote:

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?


--

Dave Peterson
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
Return SEARCHED Column Number of Numeric Label and Value Sam via OfficeKB.com Excel Worksheet Functions 23 January 30th 06 06:16 PM
Filling in a number x, y times in y cells Damien Excel Worksheet Functions 3 January 19th 06 01:49 AM
How do I limit the number of times an Excel workbook can be opene. Chris Excel Discussion (Misc queries) 8 January 19th 05 04:02 PM
Can the number of times undo is used in Excel 2002 be increased? Austrian Hannes Setting up and Configuration of Excel 2 December 6th 04 05:54 PM
how do I get a calculation to repeat various number of times? weelittlekim Excel Worksheet Functions 1 October 27th 04 08:13 PM


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