Copy certain lines from active sheet and paste it to book 1 and 2

zone709

Well-known Member
Joined
Mar 1, 2016
Messages
2,125
Office Version
  1. 365
Platform
  1. Windows
HI,

Trying to do something like this


If "Yards" is in column A then copy and paste all the rows to a new book

If "Grass" is in Column A then copy and paste all the rows to a new book.

The only thing is Grass or Yard wont start in Column A till row 2. Row 1 has my headers and I need to take always row 1 to any new book.
 
OK - we need to see the workbook to try and figure out what's happening.

Can you use a file sharing service like www.box.com and post a copy of your workbook (devoid of any sensitive information) there and provide a link to the file here and we'll have a look.
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi Trebor thanks for the reply. I am not signed up for Box.com as of now and I still really want to know why its not working. I think its something new I will learn if it ever happens again. Listen I just made a test sheet right and some fast record and code. I know this is not clean at all, but it works look.

Code:
[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]Sub Test200()
 Application.ScreenUpdating = False
 Columns("A:A").AutoFilter
    ActiveSheet.Range("$A$1:$A$1200").AutoFilter Field:=1, Criteria1:="Grass" ' need this to be unlimted
    Rows("1:500").Copy ' need this to be unlimted
    Workbooks.Add
    ActiveSheet.Paste
    Windows("Test.xlsx").Activate
    ActiveSheet.Range("$A$1:$A$1200").AutoFilter Field:=1, Criteria1:="Yards" ' need this to be unlimted
    Rows("1:500").Copy ' need this to be unlimted
    Workbooks.Add
    ActiveSheet.Paste
    Application.DisplayAlerts = False
    Windows("Test.xlsx").Close savechanges:=False
Application.DisplayAlerts = True
 Application.ScreenUpdating = True
End Sub[/FONT]
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top