ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   copy rows to another workbook (https://www.excelbanter.com/excel-discussion-misc-queries/60731-copy-rows-another-workbook.html)

sortilege

copy rows to another workbook
 
Hi,
I'm stuck with this problem: I would speed my daily work if I could
automatically copy some rows of my current worksheet (a table with 20
columns and 100 rows) in another workbook.

I thought to create a VBA macro that
1 - triggers when a button is pressed
2 - ask user for the name and location of the new workbook (a dialog box)?
3 - create such workbook
4 - copy there the rows with a "S" on the first cell of every row (column A)
5 - automatically reset the column A to blank cells.

Any hints or link to some VBA code to look at?

Thanks

Monica

Dave Peterson

copy rows to another workbook
 
How about this:

Record a macro when you copy the worksheet (Edit|move or copy sheet)
to a new workbook.

Then apply data|filter|autofilter to that new worksheet in the new workbook.

Filter column A to show the rows "not equal to" S in column A.

Delete those visible rows.

Reset the filter.

Clean up column A.

Save the new workbook as a new name.

I bet your code would be very close to what you need.

If you have trouble tweaking the code, post back with your questions.



sortilege wrote:

Hi,
I'm stuck with this problem: I would speed my daily work if I could
automatically copy some rows of my current worksheet (a table with 20
columns and 100 rows) in another workbook.

I thought to create a VBA macro that
1 - triggers when a button is pressed
2 - ask user for the name and location of the new workbook (a dialog box)?
3 - create such workbook
4 - copy there the rows with a "S" on the first cell of every row (column A)
5 - automatically reset the column A to blank cells.

Any hints or link to some VBA code to look at?

Thanks

Monica


--

Dave Peterson


All times are GMT +1. The time now is 09:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com