Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default Copying four filtered cells

Thanks to Luke, Edhardo, Jacob Scaria.
But my problem is going on.

Copying four filtered cells by means of macro ?

we know that there will be maximum 4 cells as result of filtering (or
we can also assume that we will copy only first four cells (grades))

In Luke' s I have this problem:
For example I will copy to A2 from the filtered place.
In A6, A7.... THERE ARE DATA.
If I make 100 as Luke' s suggestion these A6, A7... are overwritten




"Luke M" wrote:

Is it always the same 4 cells? How do you if it the filter will only give 4
results?
If what you are really wanting is to select all the results from the filter,
something like this:

Range("A2:A100").SpecialCells(xlCellTypeVisible).S elect
Selection.Copy

Where A2:A100 is the range you filtered, so that you won't get any extra
cells from the end of the workbook.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"CousinExcel" wrote:


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Copying four filtered cells

Please stop recreating threads. It's easier for us to see what's already been
suggested if it's all in one thread.

For the coding I gave, the A2:A100 is the range you are "filtering" not your
destination. Let's say you filter A2:A100 and it displays cells A3, A10, A12,
and A16. The code:
Range("A2:A100").SpecialCells(xlCellTypeVisible).C opy

Will only copy those four cells. You could then pick your destination cell
and paste, as in:
Range("Z1").select
Activesheet.paste

Of, perhaps we could do an intermediate step to make sure no extra data is
copied over. Using column AA as an intermediate step, and Z1 as the final
destination:

Range("A2:A100").SpecialCells(xlCellTypeVisible).C opy
'Paste into helper column
Range("AA1").select
ActiveSheet.Paste
'Remove unwanted data
Range("AA5:AA65000").ClearContents
Range("AA1:AA4").copy
'Send to desired destination
Range("Z1").select
ActiveSheet.Paste
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"CousinExcel" wrote:

Thanks to Luke, Edhardo, Jacob Scaria.
But my problem is going on.

Copying four filtered cells by means of macro ?

we know that there will be maximum 4 cells as result of filtering (or
we can also assume that we will copy only first four cells (grades))

In Luke' s I have this problem:
For example I will copy to A2 from the filtered place.
In A6, A7.... THERE ARE DATA.
If I make 100 as Luke' s suggestion these A6, A7... are overwritten




"Luke M" wrote:

Is it always the same 4 cells? How do you if it the filter will only give 4
results?
If what you are really wanting is to select all the results from the filter,
something like this:

Range("A2:A100").SpecialCells(xlCellTypeVisible).S elect
Selection.Copy

Where A2:A100 is the range you filtered, so that you won't get any extra
cells from the end of the workbook.
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"CousinExcel" wrote:


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
Copying filtered four cells by means of macro CousinExcel Excel Discussion (Misc queries) 4 January 15th 10 03:33 PM
Copying and shifting filtered data by one row & maintaining the da Copy filtered column data & shift row up Excel Discussion (Misc queries) 2 February 27th 08 08:31 PM
copying filtered data in Excel 2007 mlc Excel Discussion (Misc queries) 2 January 7th 08 07:24 PM
Copying filtered data to another worksheet DavidS Excel Worksheet Functions 4 April 7th 07 08:27 PM
Copying Filtered Data Shirley Munro Excel Discussion (Misc queries) 1 June 23rd 05 01:18 AM


All times are GMT +1. The time now is 10:02 PM.

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

About Us

"It's about Microsoft Excel"