Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Creating Duplicate Info

I have five cells of info that need to be added to over 2000 other sku's.

Example I have A, B, C, D, E and 1 - 2000 I need it to be 1A, 1B, 1C, 1D, 1E,
2A, 2B etc. I was wondering is there a faster way instead of insterting 5
lines 2000 times?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/201003/1

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Creating Duplicate Info

You can do it easily with code.

Sub AAA()
Dim Letters(1 To 5) As String
Dim LNdx As Long
Dim N As Long
Dim RowNum As Long
Letters(1) = "A"
Letters(2) = "B"
Letters(3) = "C"
Letters(4) = "D"
Letters(5) = "E"
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For N = 1 To 2000
For LNdx = LBound(Letters) To UBound(Letters)
RowNum = RowNum + 1
Cells(RowNum, "A").Value = CStr(N) & Letters(LNdx)
Next LNdx
Next N
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

It runs in less than one second to create 10000 entries.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com





On Thu, 04 Mar 2010 22:32:46 GMT, "Hinojosa via OfficeKB.com"
<u27679@uwe wrote:

I have five cells of info that need to be added to over 2000 other sku's.

Example I have A, B, C, D, E and 1 - 2000 I need it to be 1A, 1B, 1C, 1D, 1E,
2A, 2B etc. I was wondering is there a faster way instead of insterting 5
lines 2000 times?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 28
Default Creating Duplicate Info

My apologizes for being specfic, Column has A random set of numbers in which
I need to duplicate that number five times and add a statement onto each one.
I can use the Concatenate formula to add my statement (because they are five
different statements) I just don't know how to duplicate the numbers.

Chip Pearson wrote:
You can do it easily with code.

Sub AAA()
Dim Letters(1 To 5) As String
Dim LNdx As Long
Dim N As Long
Dim RowNum As Long
Letters(1) = "A"
Letters(2) = "B"
Letters(3) = "C"
Letters(4) = "D"
Letters(5) = "E"
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For N = 1 To 2000
For LNdx = LBound(Letters) To UBound(Letters)
RowNum = RowNum + 1
Cells(RowNum, "A").Value = CStr(N) & Letters(LNdx)
Next LNdx
Next N
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

It runs in less than one second to create 10000 entries.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com

I have five cells of info that need to be added to over 2000 other sku's.

Example I have A, B, C, D, E and 1 - 2000 I need it to be 1A, 1B, 1C, 1D, 1E,
2A, 2B etc. I was wondering is there a faster way instead of insterting 5
lines 2000 times?


--
Message posted via http://www.officekb.com

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Creating Duplicate Info

Try code like the following. Change the lines marked with <<< to suit
your needs.


Sub AAA()
Dim Statements(1 To 5) As String
Dim R As Range
Dim Dest As Range
Dim LastRow As Long
Dim N As Long

'<<<< CHANGE THESE VALUES
Statements(1) = "one"
Statements(2) = "two"
Statements(3) = "three"
Statements(4) = "four"
Statements(5) = "five"

' set to first cell of existing data
Set R = Worksheets("Sheet1").Range("A1") '<<<

' set to destination for new values
Set Dest = Worksheets("Sheet2").Range("B1") '<<<

With R.Worksheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

Do Until R.Row LastRow
For N = LBound(Statements) To UBound(Statements)
Dest.Value = R.Value & Statements(N)
Set Dest = Dest(2, 1)
Next N
Set R = R(2, 1)
Loop
End Sub

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com



On Fri, 05 Mar 2010 12:57:00 GMT, "Hinojosa via OfficeKB.com"
<u27679@uwe wrote:

My apologizes for being specfic, Column has A random set of numbers in which
I need to duplicate that number five times and add a statement onto each one.
I can use the Concatenate formula to add my statement (because they are five
different statements) I just don't know how to duplicate the numbers.

Chip Pearson wrote:
You can do it easily with code.

Sub AAA()
Dim Letters(1 To 5) As String
Dim LNdx As Long
Dim N As Long
Dim RowNum As Long
Letters(1) = "A"
Letters(2) = "B"
Letters(3) = "C"
Letters(4) = "D"
Letters(5) = "E"
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For N = 1 To 2000
For LNdx = LBound(Letters) To UBound(Letters)
RowNum = RowNum + 1
Cells(RowNum, "A").Value = CStr(N) & Letters(LNdx)
Next LNdx
Next N
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

It runs in less than one second to create 10000 entries.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com

I have five cells of info that need to be added to over 2000 other sku's.

Example I have A, B, C, D, E and 1 - 2000 I need it to be 1A, 1B, 1C, 1D, 1E,
2A, 2B etc. I was wondering is there a faster way instead of insterting 5
lines 2000 times?

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
Combining multiple rows with duplicate info -- help! Michael[_8_] Excel Discussion (Misc queries) 1 November 24th 09 06:34 PM
Duplicate info in a database [email protected] Excel Discussion (Misc queries) 1 April 17th 08 10:02 AM
duplicate info in cells ranvin56 Excel Worksheet Functions 2 December 12th 07 05:27 PM
how do I duplicate info from an original worksheet to another? spiderWebb Excel Discussion (Misc queries) 1 November 24th 06 03:49 PM
MERGING COLUMNS WITH DUPLICATE INFO. PatrickL Excel Worksheet Functions 2 August 19th 05 02:39 PM


All times are GMT +1. The time now is 04:41 AM.

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

About Us

"It's about Microsoft Excel"