I would like to reformat imported csv data into a custom report. The imported data has a unique record in each row. There is one column that has a value for 'fabric' of S, F or L for each record. I would like to create a macro that would take all of the records with a fabric type of S and copy and paste them into a specific area, and then repeat for the F and L. I successfully created a macro that will copy and paste by manually selecting the rows, but each report will have a varying number of records for each of the fabric types, so the manual selection does not work.
I found one post with this: ' Sub CopyLines() ' Dim wsS As Worksheet, wsD As Worksheet ' Dim lr As Long, i As Long, j As Long ' Set wsS = ThisWorkbook.Sheets("Sheet1") ' Source ' Set wsD = ThisWorkbook.Sheets("Sheet2") ' Destination ' lr = wsS.Cells(Rows.Count, "A").End(xlUp).Row ' j = 1 ' For i = 1 To lr ' IfwsS.Cells(i, 5) = 1Then ' wsS.Rows(i).CopywsD.Rows(j) ' j = j + 1 ' EndIf ' Next i ' End Sub But it's not quite right for my needs. Any help would be appreciated. Thanks, Mary --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---