How to paste values to visible/filtered cells only in Excel?
In Excel, if you have filtered data or hidden some cells, and when you paste values into the filtered or hidden range, the hidden cells will be also filled with pasted values. Here I will tell you some tricks to paste values to visible cells only in Excel.
Batch insert blank rows or columns in a specific interval in a range in Excel sheet
|If you want to insert blank rows in every other row, you may need to insert them one by one, but the Insert Blank Rows & Columns of Kutools for Excel can solve this job in seconds.
Click for 60 days free trial!
|Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.|
In Excel, there is no other ways to solve this problem except VBA.
1. Press Alt + F11 keys simultaneously, and a Microsoft Visual Basic for Applications window pops.
2. Click Insert > Module, then paste below VBA code to the popping Module window.
VBA: Paste values to visible cells only.
Sub CopyFilteredCells() 'Updateby20150203 Dim rng1 As Range Dim rng2 As Range Dim InputRng As Range Dim OutRng As Range xTitleId = "KutoolsforExcel" Set InputRng = Application.Selection Set InputRng = Application.InputBox("Copy Range :", xTitleId, InputRng.Address, Type: = 8) Set OutRng = Application.InputBox("Paste Range:", xTitleId, Type: = 8) For Each rng1 In InputRng rng1.Copy For Each rng2 In OutRng If rng2.EntireRow.RowHeight > 0 Then rng2.PasteSpecial Set OutRng = rng2.Offset(1).Resize(OutRng.Rows.Count) Exit For End If Next Next Application.CutCopyMode = False End Sub
3. Click F5 key or the Run button, then a dialog is popping out for you to select values to copy. See screenshot:
4. After selecting values, click OK, then another dialog pops out to select a range to paste the selected data. See screenshot:
5. Click OK. You can see only the visible cells are pasted the selected values.
Actually, if you use Paste to Visible Range utility of Kutools for Excel – a handy Excel tool, you can quickly and easily solve the problem of pasting values to visible range.
|Kutools for Excel, with more than 300 handy functions, makes your jobs more easier.|
After installing Kutools for Excel, please do as below:（Free Download Kutools for Excel Now!)
1. Select a range of values you want to copy and paste, then click Kutools > Range > Paste to Visible Range > All/Only Paste Values. See screenshot:
2. Then a Paste to Visible Range dialog pops out, and select the range you want to paste the values. See screenshot:
3. Click OK. Now the selected values are pasted into the visible range only.
|Paste only values to visible cells||Paste all to visible cells|
Tabbed browsing & editing multiple Excel workbooks/Word documents as Firefox, Chrome, Internet Explore 10!
You may be familiar to view multiple webpages in Firefox/Chrome/IE, and switch between them by clicking corresponding tabs easily. Here, Office Tab supports similar processing, which allow you to browse multiple Excel workbooks or Word documents in one Excel window or Word window, and easily switch between them by clicking their tabs. Click for free 45-day trial of Office Tab!
Recommended Productivity Tools
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
To post as a guest, your comment is unpublished.· 1 years agoThis worked perfectly, thanks!
To post as a guest, your comment is unpublished.· 1 years agoYou can also easily do this without a plugin....
CTRL+C the cells you want to paste
Highlight the filtered/partially hidden range you're pasting to
Select "Visible Cells Only" & hit OK
To post as a guest, your comment is unpublished.· 1 years agoVBA method did not work! It copied the invisible cells into the visible cells. Now, I realize that the title doesn't say "How to paste values FROM VISIBLE/FILTERED CELLS to visible/filtered cells only in Excel?" but if my workbook is filtered, it's highly possible that this is what is needed. If this is what you want - copy from one section to another (or to simply paste values from certain cells right back to the same cells, so to remove the fomulas) you first need to copy/paste values to an unfiltered workbook/worksheet. THEN you can use the macro...or at least I hope you can. I didn't save my data and UNDO does not work....
To post as a guest, your comment is unpublished.· 1 years agoIt is even more flexible and functional if the inner loop is constructed with Do While loop.
To post as a guest, your comment is unpublished.· 1 years agoThis was very helpful. Many thanks.