Copy and Paste Row Macro

DDav

New Member
Joined
Dec 16, 2010
Messages
7
Hi

I'm looking for a marco that will copy and paste a row when the sheet is password protected

Thanks
David
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
What row are you wanting to copy, and where are you wanting to paste it?

In order for the macro to copy/paste to a protected worksheet, the worksheet needs to be protected with a special declaration of "UserInterfaceOnly" which is done through VBA, or it needs to be unprotected/protected within the code.
 
Upvote 0
At the beginning of the macro include a line unprotecting the sheet or workbook. Then put your copy and paste code. At the end of the macro, include code to re-protect your sheet/workbook.

Protect/Unprotect code (you may want to change some of the settings I have):
Code:
'code to unprotect sheet
Sheets("Summary Sheet").Unprotect Password:="your password"
 
'code to re-protect sheet
Sheets("Summary Sheet").Protect Password:="your password", Contents:=True, Scenarios:= _
True, AllowInsertingRows:=True, AllowDeletingRows:=True, AllowSorting:= _
True, AllowFiltering:=True
Sheets("Summary Sheet").EnableSelection = xlNoRestrictions
 
Upvote 0
Thanks, i'll look into UserInterfaceOnly.

I'm looking to copy row 73 and paste it in as row 72 - if that make sense
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,451
Members
452,915
Latest member
hannnahheileen

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