ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   validating (https://www.excelbanter.com/excel-discussion-misc-queries/179918-validating.html)

Philashley

validating
 
How do I prevent people from pasting any data into cells that have a drop
down list?

Tom Hutchins

validating
 

This is from the reply by Elkar to a similar previous question:

Add this code to your workbook (use Alt-F11 to open the VB Editor, then
double-click "ThisWorkbook", then copy/paste the below code)

Private Sub Workbook_Activate()
Application.CutCopyMode = None
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Application.CutCopyMode = None
End Sub

NOTE: If the user disables macros when the workbook is opened, then this
won't work.

Hope this helps,

Hutch

"Philashley" wrote:

How do I prevent people from pasting any data into cells that have a drop
down list?


Tom Hutchins

validating
 
The code in my previous reply prevents all paste operations in the workbook.
We can modify the code to prevent pasting only to specific cells. If you just
wanted to keep the user from pasting to B10 on Sheet1, you could use:

Private Sub Workbook_Activate()
Application.CutCopyMode = None
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
If Sh.Name < "Sheet1" Then Exit Sub
If Intersect(Target, Range("B10")) Is Nothing Then Exit Sub
Application.CutCopyMode = None
End Sub

This could be expanded for multiple cells.

Hutch

"Tom Hutchins" wrote:


This is from the reply by Elkar to a similar previous question:

Add this code to your workbook (use Alt-F11 to open the VB Editor, then
double-click "ThisWorkbook", then copy/paste the below code)

Private Sub Workbook_Activate()
Application.CutCopyMode = None
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Application.CutCopyMode = None
End Sub

NOTE: If the user disables macros when the workbook is opened, then this
won't work.

Hope this helps,

Hutch

"Philashley" wrote:

How do I prevent people from pasting any data into cells that have a drop
down list?



All times are GMT +1. The time now is 09:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com