Results 1 to 4 of 4

One line of Data duplicated into multiple lines changing values of some lines

Threaded View

  1. #1
    Registered User
    Join Date
    03-26-2014
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    15

    Unhappy One line of Data duplicated into multiple lines changing values of some lines

    Hi all,

    Struggling with this one, even how to describe it.

    I have a raw data sheet that has lines of data, for this example I have only used 1 "R order number" (Column E) but in reality there could be 50 to 100. Each R Order Number could have several lines in the Raw Data sheet, and the count is based upon "R Line Number" (Column Y). This example has 1,2 and 3.

    On each of those three lines will have subtle differences in several columns which would cause the requirement for a copy of a line to be pasted into the extract sheet and edit Column AM with a new value. These rules are extensive and are included in the workbook. So the three rows can become 10 rows in the extract. The next set of data is appended to the bottom. of the extract list.

    I am at a complete loss. The VBA I have created is creating duplicate from RAW Data to the extract sheet, but then I start struggling with amendment of column AM.

    So for instance

    First rule is if Column AM has a value of "BR", then paste two identical rows in the extract sheet, and in one row put "B" in column AM, and in the other row, put "R" in column AM.

    So if each of my RAW Data rows 1,2 & 3 have BR in AM, then I will need 6 rows.



    Private Sub ConunandButton1_C1ick()
    a = Worksheets("Raw Data").Ce11s(Rows.Count, 1).End(xlUp).Row 'a counts last row in sheet
    
    For i = 2 To a  'from row 2 to a(last row in sheet1)
    
    If Worksheets("Raw Data").Cells(i, 39).Value = "BR" Then  '(if column 39 equals the criteria - amend column number to assess)
    
        Worksheets("Raw Data").Rows(i).Copy
        Worksheets("Extract").Activate
        b = Worksheets("Extract").Cells(Rows.Count, 1).End(xlüp).Row
        Worksheets("Extract").Cells(b + i, i).Select
        ActiveSheet.Paste
        
        Worksheets("Extract").Cells(b + i, i).Select
        ActiveSheet.Paste
       
        
    
        
    End If
    
    Next
    
    Application.CutCopyMode = False



    Sorry all, I am just struggling with this one. The rules have been handed to me so trying to do my best to explain. Any Help is appreciated.
    Attached Files Attached Files
    Last edited by JBeaucaire; 03-26-2020 at 04:00 PM. Reason: Added required CODE tags as per FORUM RULES, please take a moment to read them (link above in menu bar)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 08-27-2019, 02:40 PM
  2. How to combine data from multiple lines into one line
    By MikeDbes in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2016, 04:34 AM
  3. add lines with changing formulas depending on lines in another worksheet
    By fragger224 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-27-2015, 05:15 AM
  4. Multiple lines of similar data to one single line
    By T_Van in forum Excel General
    Replies: 7
    Last Post: 02-27-2012, 06:03 PM
  5. Replies: 0
    Last Post: 02-09-2012, 11:53 AM
  6. Data on multiple lines needs to be put into 1 line
    By DMBeer41 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-22-2011, 11:58 AM
  7. Duplicated lines in a data table
    By kosciosco in forum Excel General
    Replies: 0
    Last Post: 06-08-2006, 12:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1