Limit cell entry to specific text - even when copy/paste data

SirSquiddly

New Member
Joined
Jun 26, 2018
Messages
40
Hi,

My issue is this.

I have a sheet where I would like the first few columns to permit any text entry, it is various serial codes.

I would like coloumns D - P, be limited to what data can be entered.

I have made drop down boxes and ticked the box to show error alert for invalid data entry. This works well when data is input to each cell individually.

My issues is when a row is copied from another sheet and pasted into this sheet, invalid data can be entered, which I do not want. Ideally it would alert the user which cell(s) is incorrect, but would be happy if it did not allow the paste at all.

Can anyone help with this issue?

Thanks
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hello SirSquiddly

Here is some code that will turn off copy paste when the user tries to enter a designated range. You need to paste these SUBS in the SHEET level module for the sheet you want to protect. Create a named range called NoCopyRng to cover the area in Columns D-P. Try to copy some data and then paste it into a cell in one of those columns.

Code:
Private Sub Worksheet_Activate()
  Dim i As Range
  Set i = Intersect(ActiveCell, Range("NoCopyRng"))
  If Not i Is Nothing Then
    Application.CutCopyMode = False
  End If
End Sub


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  Dim i As Range
  Set i = Intersect(Target, Range("NoCopyRng"))
  If Not i Is Nothing Then
    Application.CutCopyMode = False
  End If
  
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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