Copy with Ctrl + C and paste with Ctrl + V in locked sheet

Nikko

Board Regular
Joined
Nov 26, 2018
Messages
73
Copy with Ctrl + C and paste Ctrl + V in the same locked sheet, in certain cells.
Copy with Ctrl + C cell range "R4: R18" and paste in the cell range "N4: N18" with Ctrl + V. How can I do this with VBA code?

Thanks everyone in advance for your time and effort.

Nikko
 
The End If shouldn't be there.

VBA Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As Boolean)
Me.Unprotect "1234"
If Intersect(Target, Range("R4:R18")) Is Nothing Then Exit Sub
Range("N4:N18").Value = Range("R4:R18").Value
Cancel = True
'End If
Me.Protect "1234"
End Sub
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I Try the code but have the same problem like before. The code paste the cell colour from "R4:R18" with the value in "N4:N8".

How i can paste only the Value?
 
Upvote 0
That does not paste any formatting, are you sure that you haven't got any conditional formatting on the cell.
 
Upvote 0
yep i have yellow in cells R4:R18 and Braun in N4:N18.
Paste the value and color in the cells.

To make it even easier (if that's the case ... as a VBA beginner ?),
can I just copy the "R4: R18" area with the VBA code and paste it into another unknown folder?
So I could leave the cell N4: N18 unlocked.

In retrospect, this would actually be the most suitable solution.

sory if I totally mess you up, but I'm still learning by doing ?

Thx anyway :)

Nikko
 
Upvote 0
I don't know that we are talking about the same thing, for conditional formatting click the cell that has changed then on the home tab click conditional formatting, click manage rules, check that it says current selection and then see if anything is in the large box.

You can't paste to an unknown folder/workbook.
 
Upvote 0

Forum statistics

Threads
1,215,758
Messages
6,126,704
Members
449,331
Latest member
smckenzie2016

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