Hi,
I am trying to build a system in a file where I want to control the copy paste action from the sheet1 to any other sheets or workbooks.
If the user has copied cells A1:C10 of sheet1, before he paste it in another worksheet or workbook, i want to decide whether the pasting can happen or not. I will allow only A1:A10 cells of sheet1 to be copied and pasted anywhere apart from that no other cells of sheet1 should be copied and pasted.
I am looking for a VBA code which i can put it in a worksheet and workbook events.
Note: I do not want to go by protecting sheet concept, i am looking for another way
Regards,
Hari
I suggest NOT to put in sheet or workbook code.
park the macro in the module and run it when necessary
if you want you can create a button from form toolbar (view-toolbar-form)
and assign this macro to it
see the comments in the macro
Sub test() Dim ws As String, dest As Range With Worksheets("sheet1") .Range("A1:C10").Copy ws = InputBox("type sheet name in which you want to paste e.g. Sheet3") With Worksheets(ws) 'ENSURE THAT THIS SHEET IS AVAILABLE OTHERWISE OPEN AND GIVE A NAME 'the sheet name should be exact in input box Set dest = .Cells(Rows.Count, "A").End(xlUp).Offset(1, 0) dest.PasteSpecial End With End With End Sub
Hi Venkat,
I thank you for this code, but in this code where am i restricting the user to copy only the A1:A10. My issue i want to restrict the user to copy only A1:A10 no other cells of sheet1 should be copied, is it possible to make it.
Hari
"Trying to find excel boundaries"
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks