• 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.

VBA: Count number of rows copied in a clipboard from workbook 1 going to be pasted in workbook 2

inddon

Member
Hello There,

I have 2 workbooks. Each of the workbook has one table as listed below.

Workbook 1: Table1 (certain number of columns eg. 10, and x number of rows)
Workbook 2: Table2 (Has same number of columns as above + additional help columns in the start)

I am copying all the rows from workbook 1: Table1 and pasting it in workbook 2: Table2.

The requirement:

I will create a button 'Paste' in workbook 2: Table2. When pressed, this button should do the following:

1. Count the number of rows that has been copied from workbook 1: Table1, (i.e. read it from the clipboard). For eg. 50 rows has been copied from workbook 1: Table1
2. Create that many empty rows in workbook 2: Table2 (eg. 50 rows)
3. Place the cursor in Table2 6th column and paste only the values.
4. Display message #of rows pasted.

Could you please advise, how can this be achieved?


Many thanks and look forward to hearing from you.

Regards,
Don
 
Hi !

A logic way is just to compare #rows before and after …


Hi Marc,

Thank you for your reply.

I would like to know before hand how many rows are copied/exists in the clipboard. Based on that I would like in the workbook 2: Table2 to create that many empty table rows. The process described in my previous post step 1-4.

The copy and paste involves 2 separate workbooks.

How can this be achieved using VBA?

Thanks & regards,
Don
 

The easy way is to count Table2 rows before and after
or to just count Table1 rows.

It depends also of workbooks layout and as we are not mind readers …
 
Just activate Macro recorder, operate manually then, if needed,
post your generated code here so we'll be able to arrange details

Thanks Marc,

I have got bits of code around and now trying to arrange and modify to my requirement. Once I have done will post the same here for your review.

Regards,
Don
 
Just activate Macro recorder, operate manually then, if needed,
post your generated code here so we'll be able to arrange details


Hi Marc,

As promised, I have included the copy/paste values from clipboard in the below post. This is part of the entire solution. Could you please check the same and let me know your feedback. Also, on the below post as well.

http://forum.chandoo.org/threads/vb...om-table-takes-a-long-time.32514/#post-192974

Many Thanks & regards,
Don
 
Back
Top