Restrict User to Paste Value

smstrickland

New Member
Joined
Jul 13, 2020
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I have been reading past posts to find an answer to my dilema, but have yet to find one I believe applies. I have cells with conditional formatting (no drop downs) and I want to ensure that if a user pastes data into the cells, they can only past values. I.e., it is okay for them to paste data in, but I want to retain the data validation on the cells. Any thoughts?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Welcome to MrExcel!
This code might work. Paste it in the module of your worksheet: right click on Worksheet tab > View Code (VBE opens) > paste code > close VBE.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim raSel       As Range
    Dim vFormula    As Variant

    Set raSel = Selection
    vFormula = Target.Formula
    With Application
        .EnableEvents = False
        .Undo
        Target.Formula = vFormula
        raSel.Select
        .EnableEvents = True
    End With
End Sub
 
Upvote 0
Thank you for your reply. This does seem to work with regards to the original question; however, the undo/redo button is no longer visible. Any thoughts on how to handle this?
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,772
Members
449,049
Latest member
greyangel23

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