|如果要在每隔一行中插入空行，可能需要逐个插入，但是 插入空白行和列 of Kutools for Excel 可以在几秒钟内完成这项工作。 点击获得30天的免费试用！|
|Kutools for Excel：拥有超过300个方便的Excel加载项，可以在30天内免费试用，没有限制。|
1。 按 Alt + F11键 键，同时，和 Microsoft Visual Basic for Applications 窗口弹出。
2。 点击 插页 > 模块，然后将VBA代码粘贴到弹出的模块窗口中。
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。 点击 F5 钥匙还是 跑 按钮，弹出一个对话框供您选择要复制的值。 看截图：
4。 选择值后，单击 OK，弹出另一个对话框来选择一个范围来粘贴选定的数据。 看截图：
5。 点击 OK。 您只能看到可见单元格粘贴了所选值。
其实，如果你使用 粘贴到可见范围 实用程序 Kutools for Excel - 一个方便的Excel工具，可以快速轻松地解决将值粘贴到可见范围的问题。
|Kutools for Excel, 与超过 300 方便的功能，让您的工作更轻松。|
安装后 Kutools for Excel，请按照以下步骤操作：（免费下载Kutools for Excel！）
1。 选择要复制和粘贴的值的范围，然后单击 Kutools > Range > 粘贴到可见范围 > 全部/只粘贴值。 看截图：
2。 然后a 粘贴到可见范围 弹出对话框，然后选择要粘贴值的范围。 看截图：
3。 点击 OK。 现在，选定的值仅粘贴到可见范围内。
您可能熟悉在Firefox / Chrome / IE中查看多个网页，并通过轻松单击相应的选项卡在它们之间切换。 此处，Office选项卡支持类似的处理，允许您在一个Excel窗口或Word窗口中浏览多个Excel工作簿或Word文档，并通过单击其选项卡轻松切换它们。 单击免费获得Office Tab的30天试用！
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.· 3 months agoAfter going absolutely crazy trying to find a solution, this worked - specifically, the macro for pasting INTO visible only cells. Note that I was copying only from unfiltered cells. However, the people complaining that it doesn't do both (which I'm not sure is true) should be quiet because it's pretty easy to copy FROM only visible/filtered cells into an unfiltered area. You don't need a macro for that (and if you're trying to do both, just do the copying of filtered cells in Excel first, then use this macro). Again, what Excel is fully unable to do on its own without a macro is to paste to visible cells only. This macro saved my bum. Thanks!
To post as a guest, your comment is unpublished.· 1 years agoThis worked perfectly, thanks!
To post as a guest, your comment is unpublished.· 2 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.· 2 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.· 2 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.· 2 years agoThis was very helpful. Many thanks.
To post as a guest, your comment is unpublished.· 2 years agoi am currently developing a macro. In that i need to do filter for a particular column for Eg: Column D and need to paste some values Eg: Valid in column B.
only i need to paste the value for the filtered cells.
And also i want to know the coding for multiple filters at a time. EG: filtering in one column and checking the value and again do filter in another column without making false for the previous filter.
help me on this.
To post as a guest, your comment is unpublished.· 2 years agoThis works great up to record 1163 of 23,000 and then it stops. Why would it stop?
To post as a guest, your comment is unpublished.· 3 years agoYou rock! I've had this issue multiple times in the past but it became a back-breaker for the recent project. And you've helped me to fix it beautifully. THANK YOU!
To post as a guest, your comment is unpublished.· 3 years agoThis works for me, but is there any way to select a "Paste Range" in another worksheet that is open? Thanks.
To post as a guest, your comment is unpublished.· 3 years agoGOD!! you help me so much
To post as a guest, your comment is unpublished.· 4 years agoBadass, that's all I have to say. Thank you so much.
To post as a guest, your comment is unpublished.· 4 years agoThanks for this information, helps me a lot
To post as a guest, your comment is unpublished.· 4 years agoPaste to visible range function does not work!
To post as a guest, your comment is unpublished.· 4 years agoI am curious if an Excel update has caused instability. I previously was able to use the VBA code successfully, but now it is causing the copied area to be pasted nonstop beyond the selected range. Results in Excel hanging.
To post as a guest, your comment is unpublished.· 4 years agoTried this plugin for the paste into filtered selection. Does not work for me. Crashes every time . Using excel 2013.
To post as a guest, your comment is unpublished.· 4 years agolove u man!!!!!!!!!!