Consulting

Results 1 to 6 of 6

Thread: Split into 2 rows IF - VBA

  1. #1

    Split into 2 rows IF - VBA

    Hi all,

    I am putting together a macro that takes hours worth of work away by doing all the calculations and splitting.

    I have managed to do all the basic stuff but this is a little more complicated.

    My spreadsheet has a couple of thousand rows of data, i need the macro to check for the following:-
    If DATA14 (Column N) = YES and RATE (Column D) = 21.81

    I need this line splitting into two to replace the original. (would be better if i could move the original data to another sheet to show the ones that have been split)

    One with 87% of the rate
    One with 13% of the rate (Data8 will always = OLHA on this row)

    Then the total will be recalculated based on the new rate.

    Please see screenshot below.

    If you need any more information please let me know.





    Thanks in advance
    Chris

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Could you attach a file?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Hi P45cal

    Thank you for your reply.


    Quote Originally Posted by p45cal
    Could you attach a file?

    Unfortunately I only have the file where the image is attached. This only contains the TEST data you can see in the image.

    The real data is at work. is there anything else i can do?

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Quote Originally Posted by wrightyrx7
    Unfortunately I only have the file where the image is attached. This only contains the TEST data you can see in the image.
    is there anything else i can do?
    Well that file would have been a start - it would save me from creating my own version of your file from the screenshot, not knowing what columns/rows are involved, assumptions about the values in cells (are the values as seen or formatted to n decimal places?) and so on. It would save me making mistakes, save us both time, give me something to experiment on.

    I have created such a file (attached). There are two sheets,
    one called Sheet1 which should be left alone (no pressing the buttons on that sheet) and…
    another sheet called Test Sheet which you can experiment with.

    There are two buttons,
    one calls the macro which creates a new sheet to receive copies of split rows and which splits the rows on Test Sheet at the same time.
    The other button, deletes Test Sheet and then copies Sheet1 and renames it Test Sheet, ready for more experiment.
    Attached Files Attached Files
    Last edited by p45cal; 06-11-2013 at 01:23 PM.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #5
    Considering you was working with very little data (my fault). You have done a great job!

    Works exactly how i wanted it to, thank you so so much this will save me hours of work every month.

    Thanks again

  6. #6
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    Did you try autofilter or advancedfilter ?

Posting Permissions

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