Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RW RW is offline
external usenet poster
 
Posts: 49
Default Copy last 12 rows after filtering

I need to filter some data based on a specific field. However, I need to copy
only the last 12 rows of the filtered data and paste it on another worksheet.
I know how to do all of this in VB except for determining how to only capture
the last 12 rows of the filtered data. I tried getting the last column of
data and setting the copy range from [(last row - 12) to last row] but this
gets the hidden and visible rows instead of 12 of the visible rows.

For ex. lets assume the filtered data is on rows
1,5,10,15,16,24,28,35,40,42,60,72, 75,80. I only need the last 12 so I need
rows 10 ... 80. If I use (last row-12) then it "copies" rows 68 - 80 but
really only captures the data on rows 72 and 80 since the other data between
rows 68 and 80 are hidden.

How can I accomplish this?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 644
Default Copy last 12 rows after filtering

Get the last row of the destination sheet before you copy to it, then
get it again after you've copied to it to determine how many rows were
copied, then delete all but the last 12 in the destination sheet.

Charles

RW wrote:
I need to filter some data based on a specific field. However, I need to copy
only the last 12 rows of the filtered data and paste it on another worksheet.
I know how to do all of this in VB except for determining how to only capture
the last 12 rows of the filtered data. I tried getting the last column of
data and setting the copy range from [(last row - 12) to last row] but this
gets the hidden and visible rows instead of 12 of the visible rows.

For ex. lets assume the filtered data is on rows
1,5,10,15,16,24,28,35,40,42,60,72, 75,80. I only need the last 12 so I need
rows 10 ... 80. If I use (last row-12) then it "copies" rows 68 - 80 but
really only captures the data on rows 72 and 80 since the other data between
rows 68 and 80 are hidden.

How can I accomplish this?


  #3   Report Post  
Posted to microsoft.public.excel.programming
RW RW is offline
external usenet poster
 
Posts: 49
Default Copy last 12 rows after filtering

This may be a good approach to my problem. Thanks

"Die_Another_Day" wrote:

Get the last row of the destination sheet before you copy to it, then
get it again after you've copied to it to determine how many rows were
copied, then delete all but the last 12 in the destination sheet.

Charles

RW wrote:
I need to filter some data based on a specific field. However, I need to copy
only the last 12 rows of the filtered data and paste it on another worksheet.
I know how to do all of this in VB except for determining how to only capture
the last 12 rows of the filtered data. I tried getting the last column of
data and setting the copy range from [(last row - 12) to last row] but this
gets the hidden and visible rows instead of 12 of the visible rows.

For ex. lets assume the filtered data is on rows
1,5,10,15,16,24,28,35,40,42,60,72, 75,80. I only need the last 12 so I need
rows 10 ... 80. If I use (last row-12) then it "copies" rows 68 - 80 but
really only captures the data on rows 72 and 80 since the other data between
rows 68 and 80 are hidden.

How can I accomplish this?



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
Sorting or filtering for rows Amey Excel Discussion (Misc queries) 1 December 28th 09 01:32 PM
How do I Copy and Paste onto Same Rows after filtering out rows. TWT Excel Discussion (Misc queries) 2 October 20th 08 04:09 PM
Filtering Rows ? LucaBrasi Excel Worksheet Functions 4 December 1st 06 10:24 PM
copy and paste after filtering wab_77 Excel Discussion (Misc queries) 2 July 14th 06 03:30 PM
Filtering rows with tracked changes Kiwi Mike Excel Discussion (Misc queries) 0 November 27th 04 11:50 PM


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

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"