hi,
To fix your existing code (in the original post) you could just change the last line...
' from "Selection.Paste" to "
ActiveSheet.Paste
Application.CutCopyMode = False
Or you could try the below code which I have optimised slightly by removing the un-necessary* use of "select":
*This is the way it is recorded by the macro recorder.
Sub test()
Dim RngToCopy As Range
'define the range to be copied
Set RngToCopy = Sheets("A").Range("A4:AC4")
' prepare other sheet (which is protected and has hidden cells) for pasting
With Sheets("B")
.Unprotect Password:="PASSWORD"
With .Cells
.EntireRow.Hidden = False
.EntireColumn.Hidden = False
End With
' copy & paste
RngToCopy.Copy .Range("A3").End(xlDown).Offset(1, 0)
End With
'free memory
Set RngToCopy = Nothing
End Sub
hth
Rob
Bookmarks