Private Sub Worksheet_Change(ByVal Target As Range) Dim xValue As String Dim xCheck1 As String Dim xCheck2 As String If Target.Count > 1 Then Exit Sub End If Application.EnableEvents = False xValue = Target.Value On Error Resume Next xCheck1 = Target.Validation.InCellDropdown On Error GoTo 0 Application.Undo On Error Resume Next xCheck2 = Target.Validation.InCellDropdown On Error GoTo 0 If xCheck1 = xCheck2 Then Target = xValue Else MsgBox "No pasting allowed!" End If Application.EnableEvents = True End Sub
Great, but i have a problem, when I paste the value from left cell to right then this code is working, but when I paste the value from right cell to left then this code is not working. please provide the solution.:)
I have big issue when the user paste big data in same month format, but did not allow to paste. Only provide choose option . I want user can able to paste same month data in drop down. Unwanted entry need to be stop.
Thank you very much sir for your amazing presentation. I have however noticed that your approach only works when "CTRL+V" is used for pasting. However when I right-click and select the paste special value options, I am able to go around the macro restriction. Is there another option to prevent this from happening. Thank you
Hi, Great work but the problem I am facing is that I wants to allow users to paste date that is given in data validation. How do I do it? I want my team to edit any date that is not tomorrow.
Thank you brother Raheem for the video. I have question if you plz advise how to. I have two lists of employees with weekdays. If "Employee 1" worked on "Thursday" o "List 1", than, on "List 2" his should work on Normal day. Thanks and waiting your reply plz
Did you figure this out I have formatted my cell entries so as that they cannot be seen in either formula bar or the cell and just need them to not be able to copy and paste the cell value to enable full security of the data?
HI the code is working but, IF a range is chosen, for this macro any data outside of the range cannot be pasted inside the range but within the selected range copy and paste is happening without any error message
Salam! I have a problem coding in Excel VBA, which needs your guidance. When executing a macro with the command button in Excel, an error occurs while copying and pasting the formula via VBA code. I want the VB code to run and the previous line formula to be pasted into the next line and the formula to be hidden and protected without any errors. While the rest of the cells remain unprotected for data entry. Can you guide me in this regard?
Hi, I want to allow copy paste of the data on a cell with data validation but upon paste, the data validation has to come up. By this way paste is also allowed and data validation is also protected. How do we do this
Private Sub Worksheet_Change(ByVal Target As Range) Dim xValue As String Dim xCheck1 As String Dim xCheck2 As String If Target.Count > 1 Then Exit Sub End If Application.EnableEvents = False xValue = Target.Value On Error Resume Next xCheck1 = Target.Validation.InCellDropdown On Error GoTo 0 Application.Undo On Error Resume Next xCheck2 = Target.Validation.InCellDropdown On Error GoTo 0 If xCheck1 = xCheck2 Then Target = xValue Else MsgBox "No pasting allowed!" End If Application.EnableEvents = True End Sub
@@ExcelBasement This code is not help for prevent the pasting in the sheet, able to paste from another workbook and other platform... I'm also add in last - Application.CutCopyMode = False command. but still not get the result. Please help me to resolve. Thanks
Private Sub Worksheet_Change(ByVal Target As Range) Dim xValue As String Dim xCheck1 As String Dim xCheck2 As String If Target.Count > 1 Then Exit Sub End If Application.EnableEvents = False xValue = Target.Value On Error Resume Next xCheck1 = Target.Validation.InCellDropdown On Error GoTo 0 Application.Undo On Error Resume Next xCheck2 = Target.Validation.InCellDropdown On Error GoTo 0 If xCheck1 = xCheck2 Then Target = xValue Else MsgBox "No pasting allowed!" End If Application.EnableEvents = True End Sub
Private Sub Worksheet_Change(ByVal Target As Range) Dim xValue As String Dim xCheck1 As String Dim xCheck2 As String If Target.Count > 1 Then Exit Sub End If Application.EnableEvents = False xValue = Target.Value On Error Resume Next xCheck1 = Target.Validation.InCellDropdown On Error GoTo 0 Application.Undo On Error Resume Next xCheck2 = Target.Validation.InCellDropdown On Error GoTo 0 If xCheck1 = xCheck2 Then Target = xValue Else MsgBox "No pasting allowed!" End If Application.EnableEvents = True End Sub
@@ExcelBasement its not working. When i paste this code in module and press run sub .. macro dialog box opens which only allow creating a new macro.. wht is the solution to ths? Why ths macro not showing in macros list?
Private Sub Worksheet_Change(ByVal Target As Range) Dim xValue As String Dim xCheck1 As String Dim xCheck2 As String If Target.Count > 1 Then Exit Sub End If Application.EnableEvents = False xValue = Target.Value On Error Resume Next xCheck1 = Target.Validation.InCellDropdown On Error GoTo 0 Application.Undo On Error Resume Next xCheck2 = Target.Validation.InCellDropdown On Error GoTo 0 If xCheck1 = xCheck2 Then Target = xValue Else MsgBox "No pasting allowed!" End If Application.EnableEvents = True End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xValue As String
Dim xCheck1 As String
Dim xCheck2 As String
If Target.Count > 1 Then
Exit Sub
End If
Application.EnableEvents = False
xValue = Target.Value
On Error Resume Next
xCheck1 = Target.Validation.InCellDropdown
On Error GoTo 0
Application.Undo
On Error Resume Next
xCheck2 = Target.Validation.InCellDropdown
On Error GoTo 0
If xCheck1 = xCheck2 Then
Target = xValue
Else
MsgBox "No pasting allowed!"
End If
Application.EnableEvents = True
End Sub
Thanks for this amazing code, it was really helpful for me
Where the path I should add this code thanks
Great, but i have a problem, when I paste the value from left cell to right then this code is working, but when I paste the value from right cell to left then this code is not working.
please provide the solution.:)
Thank you SO much
I have big issue when the user paste big data in same month format, but did not allow to paste.
Only provide choose option .
I want user can able to paste same month data in drop down. Unwanted entry need to be stop.
Thank you very much sir for your amazing presentation. I have however noticed that your approach only works when "CTRL+V" is used for pasting. However when I right-click and select the paste special value options, I am able to go around the macro restriction. Is there another option to prevent this from happening. Thank you
Do you have the solution for this one?
Hi, Great work but the problem I am facing is that I wants to allow users to paste date that is given in data validation. How do I do it? I want my team to edit any date that is not tomorrow.
Hi
If I have a cell with data validation list, and using VBA code if I want to select options from the drop-down list serially how can I do it?
Thank you brother Raheem for the video. I have question if you plz advise how to. I have two lists of employees with weekdays.
If "Employee 1" worked on "Thursday" o "List 1", than, on "List 2" his should work on Normal day. Thanks and waiting your reply plz
Thank you very much, this helps me, thank you from Armenia!!!!
You are welcome!
Thank you for this. Can we also have a code to prevent the person to copy the value from another workbook and paste it to this workbook? :)
Did you figure this out I have formatted my cell entries so as that they cannot be seen in either formula bar or the cell and just need them to not be able to copy and paste the cell value to enable full security of the data?
Not finding Macro details in description. Please advice
HI the code is working but,
IF a range is chosen, for this macro any data outside of the range cannot be pasted inside the range but within the selected range copy and paste is happening without any error message
Salam! I have a problem coding in Excel VBA, which needs your guidance. When executing a macro with the command button in Excel, an error occurs while copying and pasting the formula via VBA code.
I want the VB code to run and the previous line formula to be pasted into the next line and the formula to be hidden and protected without any errors. While the rest of the cells remain unprotected for data entry.
Can you guide me in this regard?
Hi,
I want to allow copy paste of the data on a cell with data validation but upon paste, the data validation has to come up. By this way paste is also allowed and data validation is also protected. How do we do this
It Works!!...superb...thanks a ton!!!🙏🙏
You're welcome!
How to do that in excel using vba macro option please make a video of that.
I tried this code, its working. But problem is if we copy entire column rule is not getting applied
Vba code is not showing in description
No pasting allowed done. Not able type and change in macro enable cell.
kindly suggest how to edit cell after prevent pasting?
Sir, Can you plz share a code to prevent user from copying value from another sheet and paste into the sheet we want to be restricted?
Some times getting error on line
applications.Undo
Please let me know solution
Thanks
I am also getting the same error. Would you please help me, if in case you got the solution by now?
Thank you brother
Welcome
Bro I tried however it's not working I have multiple dropdowns can u please guide
Thank you
You're welcome
tried the code but does not work. wondering what im doing wrong
I can't see the code in ur description box.. Pls help
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xValue As String
Dim xCheck1 As String
Dim xCheck2 As String
If Target.Count > 1 Then
Exit Sub
End If
Application.EnableEvents = False
xValue = Target.Value
On Error Resume Next
xCheck1 = Target.Validation.InCellDropdown
On Error GoTo 0
Application.Undo
On Error Resume Next
xCheck2 = Target.Validation.InCellDropdown
On Error GoTo 0
If xCheck1 = xCheck2 Then
Target = xValue
Else
MsgBox "No pasting allowed!"
End If
Application.EnableEvents = True
End Sub
@@ExcelBasement This code is not help for prevent the pasting in the sheet, able to paste from another workbook and other platform... I'm also add in last - Application.CutCopyMode = False command. but still not get the result. Please help me to resolve. Thanks
@@ExcelBasementwhere is the code
Dear Sir Its not Working - kindly help i believe the code is not working
Not working in protect sheets. Pls help
Working
Please share the code
i m unable to view description somebody can help me with code?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xValue As String
Dim xCheck1 As String
Dim xCheck2 As String
If Target.Count > 1 Then
Exit Sub
End If
Application.EnableEvents = False
xValue = Target.Value
On Error Resume Next
xCheck1 = Target.Validation.InCellDropdown
On Error GoTo 0
Application.Undo
On Error Resume Next
xCheck2 = Target.Validation.InCellDropdown
On Error GoTo 0
If xCheck1 = xCheck2 Then
Target = xValue
Else
MsgBox "No pasting allowed!"
End If
Application.EnableEvents = True
End Sub
Raheem paste the code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xValue As String
Dim xCheck1 As String
Dim xCheck2 As String
If Target.Count > 1 Then
Exit Sub
End If
Application.EnableEvents = False
xValue = Target.Value
On Error Resume Next
xCheck1 = Target.Validation.InCellDropdown
On Error GoTo 0
Application.Undo
On Error Resume Next
xCheck2 = Target.Validation.InCellDropdown
On Error GoTo 0
If xCheck1 = xCheck2 Then
Target = xValue
Else
MsgBox "No pasting allowed!"
End If
Application.EnableEvents = True
End Sub
@@ExcelBasement its not working. When i paste this code in module and press run sub .. macro dialog box opens which only allow creating a new macro.. wht is the solution to ths? Why ths macro not showing in macros list?
Sir, please share this VBA code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xValue As String
Dim xCheck1 As String
Dim xCheck2 As String
If Target.Count > 1 Then
Exit Sub
End If
Application.EnableEvents = False
xValue = Target.Value
On Error Resume Next
xCheck1 = Target.Validation.InCellDropdown
On Error GoTo 0
Application.Undo
On Error Resume Next
xCheck2 = Target.Validation.InCellDropdown
On Error GoTo 0
If xCheck1 = xCheck2 Then
Target = xValue
Else
MsgBox "No pasting allowed!"
End If
Application.EnableEvents = True
End Sub
Hello,
Please provide the macros used in the video