Need Help with Difficult Macro

  • Hey there,


    I am new to excel macros, not new to excel. New system at work has ruined my system and until we get better software I drastically need help getting something up and running.


    What I need:


    If column P says "yes" I need an entire row inserted below.

    I have $ amounts in column H and I. If column P had a yes I have to divide those into two and have it sum to equal the input. If column P did not have a yes than I need to do nothing with column H and I. Ideally the split would go into the new row that was inserted below.


    Column H / Column I / Column P

    $15.50 / $0.00 / Yes

    $0.00 / $23.97 / Yes

    $25.00 / $0.00 / No


    Ideally would turn into:

    Column H / Column I / Column P

    $7.75 / $0.00 / Yes

    $7.75 / $0.00 / Yes

    $0.00 / $11.98 / Yes

    $0.00 / $11.99 / Yes

    $25.00 / $0.00 / No


    Finally after that I need the following columns in those newly inserted row to copy the row above them, and only these columns:


    If Cells(myRow, "B") = "" Then Cells(myRow, "B") = Cells(myRow - 1, "B")

    If Cells(myRow, "C") = "" Then Cells(myRow, "C") = Cells(myRow - 1, "C")

    If Cells(myRow, "D") = "" Then Cells(myRow, "D") = Cells(myRow - 1, "D")

    If Cells(myRow, "E") = "" Then Cells(myRow, "E") = Cells(myRow - 1, "E")

    If Cells(myRow, "F") = "" Then Cells(myRow, "F") = Cells(myRow - 1, "F")

    If Cells(myRow, "G") = "" Then Cells(myRow, "G") = Cells(myRow - 1, "G")

    If Cells(myRow, "J") = "" Then Cells(myRow, "J") = Cells(myRow - 1, "J")

    If Cells(myRow, "K") = "" Then Cells(myRow, "K") = Cells(myRow - 1, "K")

    If Cells(myRow, "L") = "" Then Cells(myRow, "L") = Cells(myRow - 1, "L")

    If Cells(myRow, "M") = "" Then Cells(myRow, "M") = Cells(myRow - 1, "M")

    If Cells(myRow, "N") = "" Then Cells(myRow, "N") = Cells(myRow - 1, "N")

    If Cells(myRow, "O") = "" Then Cells(myRow, "O") = Cells(myRow - 1, "O")

    If Cells(myRow, "P") = "" Then Cells(myRow, "P") = Cells(myRow - 1, "P")

    If Cells(myRow, "Q") = "" Then Cells(myRow, "Q") = Cells(myRow - 1, "Q")


    I feel like this is a tall order. I've been using two different macros to insert a row based off my Yes and then another to duplicate, you can see some of it above. But the macro I use for dividing to equal sum input is affection the entire column of H and I, not just the one that have a Yes. Pus it puts it in the column to the right instead of the empty cell below it. If this isn't possible I understand, but it would save me hours of time each week!

  • Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post


    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.


    How to use code tags


    Just highlight all of the code and press the <> in the post menu above button to add the code tags.


    Thanks.