locked
how to split a row in to 2 or 3 rows depands on the data in the rows RRS feed

  • Question

  • hey
    I am looking for a way to split a row base on the data inside some of the cells
    The table contains a invoice and receipt data from a different software that i need to change before i upload it into the bookkeeping software 
    I need to change the data so that each row will be split to 2 rows if there is no VAT and for 3 rows if there is a number (VAT) within the vat cell . 
    Can you please give me a direction where to start ? 

    All of your help will be appreciated 

    Ran

    Friday, July 15, 2016 4:52 PM

Answers

  • Hi Ran,

    >> I need to change the data so that each row will be split to 2 rows if there is no VAT and for 3 rows if there is a number (VAT) within the vat cell

    What do you mean with each row? Is the data in one cell or different cells in one row? No matter what it is, you could insert a new row, and write the values what you want. Here is a simple code for insert a new row, and write data to it.

    Sub Macro3()
    '
    ' Macro3 Macro
    '
    
    '
        Rows("14:14").Select
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        ActiveCell.FormulaR1C1 = "Test1"
        Range("A15").Select
        ActiveCell.FormulaR1C1 = "Test2"
        Range("A16").Select
    End Sub
    

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, July 18, 2016 1:39 AM