Is there a function by which we can paste data below existing data from another workbook

  • Hello! I am new to excel-vba programming. So basically Im trying to browse a file from the computer and COPY Data from that SELECTED File in Excel using vba, Im trying to select data from filled rows available in the selected excel workbook and paste it below existing data in the desired destination workbook here as "Masterfile.xlsm",


    Can anyone PLEASE help me find errors here, suggestions to code in a better way are open.;(;(;(;(;(;(



  • Place this macro in the Masterfile workbook and run it from there.

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Just one last question, if i want to add two cells as from A4:B4 and answer in C4 after uploading the file, should i create a module or do this in general section of the excel objects

  • I'm not sure what you mean by the following:

    if i want to add two cells as from A4:B4 and answer in C4 after uploading the file

    Please clarify in detail step by step what you want to do referring to specific cells, ranges, sheets and workbooks.

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • I'm not sure what you mean by the following:

    Please clarify in detail step by step what you want to do referring to specific cells, ranges, sheets and workbooks.

    SO bascially what i want to do it

    - After uploading the data into Masterfile

    - I want to calculate the percentage (Column I) and the formula would be " ColumnG/(ColumF - ColumnH)*100"

    - I want this to calculate automatically once the data is uploaded and it should be calculated till the lastrow having the data

  • Column I was included in the range that was copied from the file that was opened. If you insert the formula in column I, whatever is already in column I that was copied over will be replaced with the formula. Is that what you want to do?

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Column I was included in the range that was copied from the file that was opened. If you insert the formula in column I, whatever is already in column I that was copied over will be replaced with the formula. Is that what you want to do?

    I want the answer in Colum I. There isnt anything in Column I before or after the upload. Column I was not included in the range that was copied from the file that was opened.

  • Just to note: Your original post included

    Code
    .Range("A2:J" & cRow).Copy

    This range includes column I.

    Do you want the formula to start in row 2 of column I ?

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Just to note: Your original post included

    Code
    .Range("A2:J" & cRow).Copy

    This range includes column I.

    Do you want the formula to start in row 2 of column I ?

    Apologies for the inconvenience, Actually I changed it, its now till columnH

    .Range("A2:H" & cRow).Copy


    and Yes i want to start from row2 thats where the data starts to filling in the copying procedure

  • Just to note: Your original post included

    Code
    .Range("A2:J" & cRow).Copy

    This range includes column I.

    Do you want the formula to start in row 2 of column I ?

    Formula is

    ColumnI = ColumnG/(ColumF - ColumnH)*100

  • Give this a try:

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Give this a try:

    This is just working first 2 rows not until the last row having the data

  • Are there any blank cells in column I? Can you attach a copy of the Master file after the data has been imported from the other file?

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Try:

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Try:

    Sorry but its still the same! its only getting calculated for just firts 2 rows in ColumnI

  • Please attach a copy of the other workbook so I can test the macro.

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

  • Give this a try:

    One thing i further noticed that its not working till the end row until I upload some data from either same or different workbook. As soon as the data is filled twice columnI is calculated for the previous uplaoded data

  • I updated the code in Post #20. Please use that revised version. It looks for the last row with data and then fills in the formula in column I. If you have no data, then there be no formulas. Also, please look at Post #21.

    You can say "THANK YOU" for help received by clicking the "Like" icon in the bottom right corner of the helper's post.
    Practice makes perfect. I am very far from perfect so I'm still practising.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!