View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
cousinexcel cousinexcel is offline
external usenet poster
 
Posts: 26
Default Copying filtered four cells by means of macro

Hi Luke,
it is such a case, we know that there will be maximum 4 cells as result (or
we can assume that we will copy first four cells)

In your solution I have this problem:
For example I will copy to A2.
In A6, A7.... THERE ARE DATA.
If I make 100 as you suggested 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:

Thank you Eduardo.
I need it in a macro.
Jacob Scaria has sent the statement

'ActiveCell.Resize(4).Select
'ActiveCell.Resize(4).Copy

it did not help me, maybe my lack of konowledge,
becuase that way the macro copies and pastes filtered away (hidden) cells as
well.
I need the macro to selecet and copy only four appearing cells


"Eduardo" wrote:

Hi,
Highlight the filtered data, press CTRL + G, special, in the right column
select "Visible cells Only", ok, then press CTRL + C, go to where you need to
paste the information and paste it

if this helps please click yes thanks

"CousinExcel" wrote:

Thanks to Jacob Skaria.
But still I need to mark and copy four cells by shift+down+down+down+down I
believe.

There are filtered cells and when I say things other than shift and down
keys it is copying hidden (filtered away) cells I believe.

I hope copying by selecting by "shiftt+down+down+down+down" will solve my
need.

Sorry for repating I just try to explain my need:
I filter the data by a macro.
Then I need to copy four cells apeering on the screen.

Thanks,

Cousin Excel