Copy and Paste Row not working when filtered

Dave8899

New Member
Joined
Jan 17, 2019
Messages
32
Hi I have the below code(below) that works off a button, to copy an entire row it works fine, however for some reason When the sheet is filtered, it just inserts a blank line, any ideas?

Code:
Sub Copy_paste()


Dim MyPassword As String
    MyPassword = "Yes"
    If InputBox("Please enter password to continue.", "Enter Password") <> MyPassword Then
        Exit Sub
        End If


 ActiveSheet.Unprotect Password:="1234"
  
ActiveCell.EntireRow.Select
Selection.Copy
Selection.Insert


 ActiveSheet.Protect Password:="1234", AllowFiltering:=True, AllowFormattingColumns:=True, Contents:=True, DrawingObjects:=True, UserInterfaceOnly:=True, AllowFormattingCells:=True
 
End Sub
 
Last edited:

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
The code works for me. The only time it inserts a blank row is if the active cell is in a blank row & in that case inserting a blank row is what I would expect.
We don't know what your data is like, how it is filtered of where you active cell might be so obviously we cannot replicate your particular circumstances.
 
Upvote 0
The code works for me. The only time it inserts a blank row is if the active cell is in a blank row & in that case inserting a blank row is what I would expect.
We don't know what your data is like, how it is filtered of where you active cell might be so obviously we cannot replicate your particular circumstances.


Hi hi thanks for the response, the data is a number of formulas and standard data names & address. As for the filter it’s a standard excel filter the only restriction is the filtered items are selected from a list.

It is a strange one.
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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