Copy paste into filtered rows

acurious1982

New Member
Joined
Sep 7, 2013
Messages
2
Hi,

consider column A has a number of rows which we want to filter for certain values. After that we want to copy paste those cells in the filtered A range into its adjacent column (i.e. B). If you simply copy paste them into B, the copied values will be pasted into the unfiltered rows of A instead of against each A range value!!!

I hope I made sense here. please see below as eg:

Column A Column B
15
20
35
48
55

Filiter A for anything above 20, that is:

Column A Column B
35
48
55

thanks heaps
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi,
Others here may have better solutions but one way would be to copy the values to Column B before you apply the filter.
see if this helps. Place code in standard module.

Code:
Sub CopyFilterData()
    Dim item As Range
    Dim rng As Range
    Dim FilterValue As Integer
    FilterValue = 20
    With Worksheets(1)
        Set rng = .Range("A1:A" & .Cells(.Rows.Count, "A").End(xlUp).Row)
    End With
    rng.AutoFilter
    For Each item In rng
        If item.Value > FilterValue Then item.Offset(0, 1).Value = item.Value
    Next
    rng.AutoFilter Field:=1, Criteria1:=">" & FilterValue
End Sub

I have assumed your data is located on sheet 1 - change as required.
 
Upvote 0

Forum statistics

Threads
1,215,460
Messages
6,124,949
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top