Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copying on a filtered column

Greetings,

I have a list of data in Column A through Column C.
Columns B and C contain data from which I will be
filtering the data. I need some code that would allow me
to copy the first 10 items in column A, and paste them to
Column A of a different sheet ("Sheet 2"). Obviously,
this is fairly simple if the filter is not applied, as I
can come up with code that would select the range (A2:A11)
and copy it over. However, when the filter is applied,
the range varies, because the filter hides various rows.
Even when the filter applies, I want the code to select
just the first ten items (which are not hidden by the
filter), and copy those over to sheet 2. I would
appreciate any help you could give. Thanks

Jason
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Copying on a filtered column

Sub test5()
Dim rng As Range, rng2 As Range
Dim iCell As Range, i As Long
Set rng = Sheets(1).Range("A2:a100")
Set rng2 = Sheets(2).Range("A2")
Set partRng = rng.SpecialCells(xlCellTypeVisible)
i = 1
For Each iCell In partRng
rng2(i).Value = iCell.Value
If i = 10 Then Exit Sub
i = i + 1
Next
End Sub

Alan Beban


Jason wrote:
Greetings,

I have a list of data in Column A through Column C.
Columns B and C contain data from which I will be
filtering the data. I need some code that would allow me
to copy the first 10 items in column A, and paste them to
Column A of a different sheet ("Sheet 2"). Obviously,
this is fairly simple if the filter is not applied, as I
can come up with code that would select the range (A2:A11)
and copy it over. However, when the filter is applied,
the range varies, because the filter hides various rows.
Even when the filter applies, I want the code to select
just the first ten items (which are not hidden by the
filter), and copy those over to sheet 2. I would
appreciate any help you could give. Thanks

Jason


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 four filtered cells CousinExcel Excel Discussion (Misc queries) 1 January 15th 10 04:14 PM
copying one column with hidden/filtered rows to another colum Rechie Excel Discussion (Misc queries) 2 September 14th 09 06:28 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 04:08 AM.

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"