#1   Report Post  
Posted to microsoft.public.excel.misc
Hans Knudsen
 
Posts: n/a
Default Copy filtered data

Let's say I have data in A1:Gxx. Now I use Autofilter to find all rows which has a "2" in column C. Let's say it leaves rows 1:4 and
8:10. Now I want to copy the filtered data in columns F:G and paste the values (not to an empty range which is easy) but to the same
cells in colums D:E.

Any help?

Hans Knudsen


  #2   Report Post  
Posted to microsoft.public.excel.misc
Alan
 
Posts: n/a
Default Copy filtered data

Try Advanced Filter, excellent tutorial here from Debra Dalgeish, owner of
the site,
http://www.contextures.com/xladvfilter01.html#ApplyAF
Regards,
Alan.
"Hans Knudsen" wrote in message
...
Let's say I have data in A1:Gxx. Now I use Autofilter to find all rows
which has a "2" in column C. Let's say it leaves rows 1:4 and 8:10. Now I
want to copy the filtered data in columns F:G and paste the values (not to
an empty range which is easy) but to the same cells in colums D:E.

Any help?

Hans Knudsen



  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Copy filtered data

This assumes that you applied the filter to the worksheet.

Option Explicit
Sub testme()
Dim myRng As Range
Dim myArea As Range

With Worksheets("sheet1")
If .AutoFilter.Range.Columns(1).Cells _
.SpecialCells(xlCellTypeVisible).Cells.Count = 1 Then
'only the header row showing.
'do nothing
Else
With .AutoFilter.Range
Set myRng = Intersect(.Resize(.Rows.Count - 1) _
.Offset(1, 0).Cells.SpecialCells(xlCellTypeVisible), _
.Parent.Range("F:G"))
For Each myArea In myRng.Areas
myArea.Offset(0, -2).Value = myArea.Value
Next myArea
End With
End If
End With

End Sub

Hans Knudsen wrote:

Let's say I have data in A1:Gxx. Now I use Autofilter to find all rows which has a "2" in column C. Let's say it leaves rows 1:4 and
8:10. Now I want to copy the filtered data in columns F:G and paste the values (not to an empty range which is easy) but to the same
cells in colums D:E.

Any help?

Hans Knudsen


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.misc
Hans Knudsen
 
Posts: n/a
Default Copy filtered data

Just what I wanted!
Thank you very much Dave Peterson.

Hans Knudsen


"Dave Peterson" skrev i en meddelelse ...
This assumes that you applied the filter to the worksheet.

Option Explicit
Sub testme()
Dim myRng As Range
Dim myArea As Range

With Worksheets("sheet1")
If .AutoFilter.Range.Columns(1).Cells _
.SpecialCells(xlCellTypeVisible).Cells.Count = 1 Then
'only the header row showing.
'do nothing
Else
With .AutoFilter.Range
Set myRng = Intersect(.Resize(.Rows.Count - 1) _
.Offset(1, 0).Cells.SpecialCells(xlCellTypeVisible), _
.Parent.Range("F:G"))
For Each myArea In myRng.Areas
myArea.Offset(0, -2).Value = myArea.Value
Next myArea
End With
End If
End With

End Sub

Hans Knudsen wrote:

Let's say I have data in A1:Gxx. Now I use Autofilter to find all rows which has a "2" in column C. Let's say it leaves rows 1:4
and
8:10. Now I want to copy the filtered data in columns F:G and paste the values (not to an empty range which is easy) but to the
same
cells in colums D:E.

Any help?

Hans Knudsen


--

Dave Peterson



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
Email only the filtered data stefani13 Excel Worksheet Functions 5 August 15th 05 10:22 PM
Copying Filtered Data Shirley Munro Excel Discussion (Misc queries) 1 June 23rd 05 01:18 AM
reminder notifications in a column L Mieth Excel Discussion (Misc queries) 6 June 10th 05 11:00 AM
How do i copy columns of data in notepad into microsoft excel? Jason Excel Discussion (Misc queries) 3 February 12th 05 02:04 AM
How do i copy columns of data in notepad into microsoft excel? Jason Excel Discussion (Misc queries) 1 February 10th 05 11:05 PM


All times are GMT +1. The time now is 08:50 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"