Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Filter and Copy?

I am using the following code to use so when the user enters the filter
criteria (date) into cell E2 and clicks a Command Button, the macro filters
the data in column A, per the criteria, and copies the corresponding rows
through Row J. It then pastes it into a new page where it can be printed.

My problem is that column A contains dates from 6/30/07 to present (and
continuing). The code is not properly filtering the data based upon the
criteria in E2. It's copying almost all the data in column A and only part
of the corresponding rows.

I'd also like it to only copy the cells that contain data, not ALL the cells
up to 500.

I'm stuck. Can someone help me here? TIA...

Sub Advanced_Filter()
Range("A6:J500").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range("E2"), CopyToRange:=Range("Print!A5"), Unique:=False
Sheets("Print").Select
Range("A5").Select
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Filter and Copy?

the criteria range should be as a minimun two contiguous cells in the same
column.

When I put the header name for the date column in E1 and ran this

Sub Advanced_Filter()
Range("A6:J500").AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Range("E1:E2"), _
CopyToRange:=Range("Print!A5"), _
Unique:=False
Sheets("Print").Select
Range("A5").Select
End Sub

it worked for me.

--
Regards,
Tom Ogilvy


"Mark" wrote:

I am using the following code to use so when the user enters the filter
criteria (date) into cell E2 and clicks a Command Button, the macro filters
the data in column A, per the criteria, and copies the corresponding rows
through Row J. It then pastes it into a new page where it can be printed.

My problem is that column A contains dates from 6/30/07 to present (and
continuing). The code is not properly filtering the data based upon the
criteria in E2. It's copying almost all the data in column A and only part
of the corresponding rows.

I'd also like it to only copy the cells that contain data, not ALL the cells
up to 500.

I'm stuck. Can someone help me here? TIA...

Sub Advanced_Filter()
Range("A6:J500").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range("E2"), CopyToRange:=Range("Print!A5"), Unique:=False
Sheets("Print").Select
Range("A5").Select
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Filter and Copy?

Hello Tom.

I tried to make E1:E2 the criteria cells, but I still end up the the code
copying every day and pasting in in Print!A5, but it copies absolutely NO
data from B6:J500


"Tom Ogilvy" wrote in message
...
the criteria range should be as a minimun two contiguous cells in the same
column.

When I put the header name for the date column in E1 and ran this

Sub Advanced_Filter()
Range("A6:J500").AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Range("E1:E2"), _
CopyToRange:=Range("Print!A5"), _
Unique:=False
Sheets("Print").Select
Range("A5").Select
End Sub

it worked for me.

--
Regards,
Tom Ogilvy


"Mark" wrote:

I am using the following code to use so when the user enters the filter
criteria (date) into cell E2 and clicks a Command Button, the macro
filters
the data in column A, per the criteria, and copies the corresponding rows
through Row J. It then pastes it into a new page where it can be
printed.

My problem is that column A contains dates from 6/30/07 to present (and
continuing). The code is not properly filtering the data based upon the
criteria in E2. It's copying almost all the data in column A and only
part
of the corresponding rows.

I'd also like it to only copy the cells that contain data, not ALL the
cells
up to 500.

I'm stuck. Can someone help me here? TIA...

Sub Advanced_Filter()
Range("A6:J500").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range("E2"), CopyToRange:=Range("Print!A5"), Unique:=False
Sheets("Print").Select
Range("A5").Select
End Sub





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Filter and Copy?

OK....Now I have it to copy ALL the data, but it's not filtering by date
yet. It looks like it copied the entire section A6:J500 and has kept it in
the clipboard. That's what it pastes in Print!A5 each time now....
Everything!

Suggestions?


"Tom Ogilvy" wrote in message
...
the criteria range should be as a minimun two contiguous cells in the same
column.

When I put the header name for the date column in E1 and ran this

Sub Advanced_Filter()
Range("A6:J500").AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Range("E1:E2"), _
CopyToRange:=Range("Print!A5"), _
Unique:=False
Sheets("Print").Select
Range("A5").Select
End Sub

it worked for me.

--
Regards,
Tom Ogilvy


"Mark" wrote:

I am using the following code to use so when the user enters the filter
criteria (date) into cell E2 and clicks a Command Button, the macro
filters
the data in column A, per the criteria, and copies the corresponding rows
through Row J. It then pastes it into a new page where it can be
printed.

My problem is that column A contains dates from 6/30/07 to present (and
continuing). The code is not properly filtering the data based upon the
criteria in E2. It's copying almost all the data in column A and only
part
of the corresponding rows.

I'd also like it to only copy the cells that contain data, not ALL the
cells
up to 500.

I'm stuck. Can someone help me here? TIA...

Sub Advanced_Filter()
Range("A6:J500").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Range("E2"), CopyToRange:=Range("Print!A5"), Unique:=False
Sheets("Print").Select
Range("A5").Select
End Sub





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy only visible cells after filter is applied/ sum after filter MAM Excel Worksheet Functions 0 April 9th 08 04:09 AM
filter and copy JOM Excel Programming 1 June 13th 07 06:01 PM
Need macro to filter, create tab on filter and copy/paste Jen[_11_] Excel Programming 1 May 2nd 06 04:45 PM
Need macro to filter, create tab on filter and copy/paste Jen[_11_] Excel Programming 1 May 2nd 06 04:45 PM
Filter and copy gavmer[_87_] Excel Programming 0 October 6th 04 12:55 AM


All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"