PC Review


Reply
Thread Tools Rate Thread

Copying four filtered cells

 
 
CousinExcel
Guest
Posts: n/a
 
      15th Jan 2010
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).Select
> 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 With Quote
 
 
 
 
Luke M
Guest
Posts: n/a
 
      15th Jan 2010
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).Copy

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).Copy
'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).Select
> > 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying filtered four cells by means of macro CousinExcel Microsoft Excel Misc 4 15th Jan 2010 03:33 PM
Copying filtered cells from a specific location kativa Microsoft Excel Programming 2 4th Apr 2008 01:31 PM
Copying into Filtered cells =?Utf-8?B?U25hcmE=?= Microsoft Excel Discussion 3 28th May 2007 06:03 PM
Copying the filtered data to clipboard is copying non-visible rows =?Utf-8?B?U2VldGhhUmFtYW4=?= Microsoft Excel Crashes 10 12th Jul 2006 09:39 PM
Copying filtered, merged cells bennerob Microsoft Excel Worksheet Functions 1 15th Jul 2003 03:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:27 AM.