• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel VBA Script for Copy/Paste Dynamically from One Worksheet to Another

damonl

New Member
I have a worksheet with 12 different columns and an insert row command button where users can add rows as they input data into the rows. I have created a separate spreadsheet. where I would like to have a tabulate command button that the user can press and it would populate the table with all the data from the relevant columns. Some of the columns in this spreadsheet would be reserved for calculations as such these cells would have formulas that would read from the columns that have been auto filled from the command button. Is there a VBA script I can use for this command button?

To further elaborate, I have attached two screenshots. I wish to copy all the inputted data from columns B, D, G, IK, L and M in the capture.png screen grab into the columns in the relevant columns into the 2nd spreadsheet. (Capture 2.png screen grab) It would have to be dynamic as the number of rows depends on how many rows the user inserts in the first worksheet. The table would also have to be formatted with border lines and colour. Columns I to L in the 2nd spreadsheet will have their own formulas so that would have to be copied into the dynamic creation of the table.
 

Attachments

  • Capture 2.PNG
    Capture 2.PNG
    45.4 KB · Views: 17
  • Capture.PNG
    Capture.PNG
    49.1 KB · Views: 15

damonl

You should able to send a sample Excel-file which has some sample data.
There are some challenges to verify that with those snapshots.
Can You use real Tables?
...then eg no need to have [ Insert Rows ]-button.
 
Thanks, I have attached a sample with the two worksheets in question with sample data.
 

Attachments

  • Sample.xlsm
    29.3 KB · Views: 7

damonl

You skipped my question ... for some reason.
If 'click' more than once then there will add as many times something to other sheet - or how?

Both sheet do not have Design Limit [kWh/m2/Yr] -text ... ideas?
 
Last edited:
Column L and M in the 2nd screengrab has the design limit column in it and column M in the first screengrab.
I don't have an issue with an insert button as have managed to do this but want a command button that will copy and paste dynamically based on the number of rows in the first spreadsheet into the 2nd spreadsheet. Copying only B, D, G, I, K, L and M. I also need to automatically format the new table to include bordered rows and coloured in.
 
Back
Top