Try this:
Sub GetOutput() Dim rngFrom As Range Dim rngTo As Range Dim rngCell As Range Dim wksOutput As Worksheet Dim rngCell2 As Range Dim lngRow As Long Set rngFrom = Range("rngFrom").Resize(Range("rngFrom").End(xlDown).Row - (Range("rngFrom").Row - 1), 1) Set rngTo = Range("rngTo").Resize(1, Range("rngto").End(xlToRight).Column - (Range("rngTo").Column - 1)) Set wksOutput = ThisWorkbook.Worksheets.Add lngRow = 2 For Each rngCell In rngFrom For Each rngCell2 In rngTo wksOutput.Range("A" & lngRow).Value = rngCell.Value wksOutput.Range("B" & lngRow).Value = rngCell2.Value wksOutput.Range("C" & lngRow).Value = rngCell2.Offset(rngCell.Row - 12).Value lngRow = lngRow + 1 Next Next End Sub From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com] On Behalf Of Pehrson, Dave Sent: Jan/Fri/2012 01:39 To: excel-macros@googlegroups.com Cc: 'ashish koul' Subject: $$Excel-Macros$$ Data Matrix Macro I have developed a matrix to capture change over time from one production model to another, and now I need to upload into a software package with a format as from To Time WT-628 WT-628 0 WT-628 WT-629 15 WT-628 WT-630 45 (see attached partial example of requested output. The process I used manually is outlined as shown below, I'm not a programmer and you may know a more efficient process to achieve the desired results. I assume a series of loops would be required. (Note: as I do this process in different areas, the number of data sets will be different and I assume would become a variable. ) 1. Define number of data sets (Constant) by counting the number of parts on the list in column H 2. Copy part numbers in column H (Data Matrix) to D4 in (Output) 3. Copy the first number in the data set and paste to C4 in (output) a. Copy that part to end of data set in column D 4. Copy the Times in Row I13 to I plus 21 (constant) row 13 and paste to (output) E4 (transposed) 5. Repeat this process 21 (constant times) advancing the part number for column C by one, and the data in data row by one row I hope this is clear, please let me know if you have any questions. Your support and expertise is greatly appreciated. Again I'm not a programmer so if you have a better way than I outlined in my manual steps above, please go with your ideas, It's the results that's important and I'm always trying to learn more effective routines. Thanks David Pehrson -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ---------------------------------------------------------------------------- -------------------------- To post to this group, send email to excel-macros@googlegroups.com -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com
<<image002.gif>>