Posts by arienette

    EDIT: Apologies, I've just realised that the reason why both tables change is that I am deleting rows in my code... I have no idea why it took me so long to realise it, must have had a complete brain melt over the weekend.

    I have made the procedure slightly more complicated but separated the lists into two separate sheets so that no data is being lost.

    Apologies for wasting everyone's time on such a simple answer! Thanks again

    Hi alansidman

    Thank you for your reply and apologies for getting back to you so late.

    Thank you for pointing out I can achieve the result I need in Power Query, that's really useful.

    Just to check - apologies if I'm missing something - will the Mcode you posted help me to modify my VBA code? I do need this task running through the Command Buttons for other people to execute without a problem.

    My code does almost exactly what it is supposed to, except it takes the range as a whole spreadsheet and not just the range I need it to work on. I am unsure where my coding has gone wrong but I suspect it must be something with the way I define rows? I may be completely wrong here and that's why I decided to post here.

    If I use the Mcode in my command button - would that work?

    Thank you!

    Hi All,

    I am quite stuck with the below.

    I have four columns A-D, e.g.:

    A B C D
    Joe ZZ 4 X
    Tom YY 5 X
    Aida YY 2 X
    Tom ZZ 2 X
    Joe ZZ 1 X
    Joe YY 6 X
    Aida YY 0 X
    Tom ZZ 7 X
    Joe YY 4 X

    I want to merge rows for which info in both columns A and B are identical, add for those rows values in column C and retain info from column D untouched (column D is irrelevant for this problem but including it here just to be consistent with my range). So my final product will look:

    A B C D
    Joe ZZ 5 X
    Tom YY 14 X
    Aida YY 2 X
    Joe YY 10 X

    I also want to retain both of my lists - the original and the merged one.

    To achieve the above, I have written some VBA code:

    First, I want to copy my original list from columns A:D to columns F:I and then I want the operations to be performed on the F:I range only.

    What my code does it is copies the columns over but still performs the merging and adding the values on both ranges (the original data and the copied data). I am therefore left with two ranges side by side, both of which are merged and I lose my original data.

    I am very new to VBA and cannot see a reason why it would do that. I've tried looking through posts for solutions but nothing answered my questions so far. I apologise in advance if the code is not the best but it's my first steps.

    I would be extremely grateful if you could point me in the right direction.

    Hi All,

    I am working on two sheets in the same spreadsheet.

    In Sheet 1, I want to only select rows that in the 3rd column have "Science and Engineering" written.

    From those selected rows, I only want to copy cells in column 3, 6 and 5 (in this order) and copy them into Sheet 2 into columns 1-3 as Links, so that if any information in Sheet 1 gets updated, so will the respective info in Sheet 2.

    After those were copied, I would like to sort the copied data in Sheet 2, in a descending order, based on values in Column 2 in Sheet 2.

    So far I have code here that can select the rows that meet the criteria, and copy them all as links into Sheet 2 but I am struggling to copy only selected cells and add the sorting component to the code.

    I am a beginner with VBA and have managed to piece the above thanks to various YT tutorials but am struggling to find anything that would satisfy all this together - I am not sure whether this can be done to begin with?

    I'd really appreciate any help, thanks in advance!