Copy and paste on hidden rows or columns

Cris_Jon

New Member
Joined
Jun 28, 2018
Messages
4
Hi

Please help on how i Can paste items if i have a column filtered or have rows that are hidden.

I filtered column A, so some rows are hidden, next I want to paste data on the filtered column with out changing the data on the hidden rows.

Thanks!

Do let me know if it is confusing.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Hope this helps....

Copy & Paste Visible Cells:
Select the entire range you want to copy--– Press Ctrl+C or Right-click>Copy.. Select the cell or range that you want to paste to and Press Alt+ to select the visible cells only (the filtered cells).. ... .

Paste the range – Press Ctrl+V or Right-click>Paste.
 
Upvote 0
I answered this similar problem in another thread.
https://www.mrexcel.com/forum/excel-...ered-list.html

Here is the code:


Code:
Sub CopyVisibleToVisible()
'Copy paste(value):
'from filtered to filtered range
'from filtered to unfiltered range
'from unfiltered to filtered range
'Not work on hidden column

    Dim rngA As Range
    Dim rngB As Range
    Dim r As Range
    Dim Title As String
    Dim ra As Long
    Dim rc As Long
    
    Title = "Copy Visible To Visible"
    Set rngA = Application.Selection
    Set rngA = Application.InputBox("Copy Range :", Title, rngA.Address, Type:=8)
    
    Set rngB = Application.InputBox("Paste Range (select the first cell only):", Title, Type:=8)
    Set rngB = rngB.Cells(1, 1)
    Application.ScreenUpdating = False

    ra = rngA.Rows.count
    rc = rngA.Columns.count
    Set rngA = rngA.Cells(1, 1).Resize(ra, 1)
    
    For Each r In rngA.SpecialCells(xlCellTypeVisible)
      rngB.Resize(1, rc).Value = r.Resize(1, rc).Value
        Do
          Set rngB = rngB.Offset(1, 0)
        Loop Until rngB.RowHeight <> 0
    Next
    
    Application.Goto rngB
    Application.ScreenUpdating = True
    Application.CutCopyMode = False

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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