# Solved: Pasting in excel from unfiltered sheet to filtered sheet



## comet1771 (Jul 1, 2010)

Hi,

I need to paste data from one worksheet that is *un*filtered (not hidden) onto a worksheet that is filtered. I need to paste onto visable cells only, ignoring the hidden rows. Currently, my data is being pasted onto both visible and hidden rows.

I know its possible to paste only visable data, ignoring hidden cells, but I need to do the reverse of this. Pasting non hidden data onto only visible cells. And I hope I am explaining this well.

Please do not suggest a vlookup because this would take entirely too long due to the nature of my data and this project. Also, I am not skilled enough to do code, so keep it simple...

Suggestions please?


----------



## etaf (Oct 2, 2003)

if you go down to the end of the worksheet where the data is filtered you should see consecutive rows - then you can paste into the last row.
Just tried with a simple two column sheet and it works on excel 2003
To filter the new data you will need to re filter again, the new data pasted was not filtered - so I just clicked on the dropdown and selected the filter again and it refiltered all the data


----------



## comet1771 (Jul 1, 2010)

Thanks for the response, but this really does not solve the problem. I don't think I explained properly, so I am going to try again with a simplified example.

I have workbook 1 with data in columns A through D, and rows 1 through 4. I need to paste this data into workbook 2. For the data to be pasted into the correct cells, I need to filter the data in workbook 2. So, when I filter it, I'm looking at rows A through D, and rows 1,5,7,15. When I try to paste the 16 cells of data from the unfiltered workbook 1 into the filtered workbook 2, it is pasting into the hidden cells. But, I need it to paste into rows 1,5,7,15. I am looking for a way to paste into visible cells only.

The data is a survey, so each time I get results from a city, I need to filter to the appropriate country, state, and city to paste into. Thus, a vlookup would be tedious if I want to paste the responses as I get them.

I hope this makes more sense and explains why your solution will not work for me.

I'd appreciate another suggestion from you or anyone else??

Thanks!


----------



## slurpee55 (Oct 20, 2004)

If you start with your cursor in cell A1 of the data you want copied over, this simple macro will copy the information to the correct rows when run (note: in my case the data to be copied was on Sheet2 and was copied to Sheet1. The names would have to be changed to reflect what you call those sheets.)

```
Sub Macro1()

    Range("A1:D1").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Sheet1").Select
    Range("A1").Select
    ActiveSheet.Paste
    Sheets("Sheet2").Select
    Range("A2:D2").Select
    Range("D2").Activate
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Sheet1").Select
    Range("A5").Select
    ActiveSheet.Paste
    Sheets("Sheet2").Select
    Range("A3:D3").Select
    Range("D3").Activate
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Sheet1").Select
    Range("A7").Select
    ActiveSheet.Paste
    Sheets("Sheet2").Select
    Range("A4:D4").Select
    Range("D4").Activate
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Sheet1").Select
    Range("A15").Select
    ActiveSheet.Paste
End Sub
```
You would want to copy this code and paste it into a module of the workbook, not one of the sheets.


----------



## comet1771 (Jul 1, 2010)

Thanks for the response. I will try this.


----------

