+ Reply to Thread
Results 1 to 8 of 8

How to write code to restrict the copy-paste if sheet is having more than one drop-down?

  1. #1
    Registered User
    Join Date
    05-30-2014
    Posts
    23

    How to write code to restrict the copy-paste if sheet is having more than one drop-down?

    Hi

    I have total 4 drop-downs in my sheet A column - Resource Designation , B - User Type, C - Organizational Unit and D - Country.

    Previously I have posted my question here for one drop-down Resource Designation. I got the below code from the Forum.

    I am trying to change the code for the other three drop-downs as well but getting some errors not code wise but not working as expected.

    Can you please help me in combining the same code to work for all 4 drop-downs?


    Thanks
    Mounika


    Please Login or Register  to view this content.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: How to write code to restrict the copy-paste if sheet is having more than one drop-dow

    Copy the below code and do right click on sheet tab and select view code and paste it.

    Close the VBA window (Alt+Q to close VBA window) and return to that sheet and check.

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    05-30-2014
    Posts
    23

    Re: How to write code to restrict the copy-paste if sheet is having more than one drop-dow

    Hi
    Thanks for the reply , but i don't want to disable the paste and copy in my sheet. I just want to pop-up an error message whenever user paste the wrong value in the drop-down. Please find the attached sheet for example , it's already having the code for Resource Designation drop-down , it has total 3 values Clerical, Manager,Professional. If i paste say clerk ,it will throw an error saying please select correct value from drop-down.


    I need the similar functionality for remaining drop-downs User Type, Organizational Unit and Country.

    But when i used the same code with variable change and range changes, it is not working as expected.Please help me to get through this.


    Thanks for the continuous help from the forum members.
    Attached Files Attached Files

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: How to write code to restrict the copy-paste if sheet is having more than one drop-dow

    Sorry, I don't know the way to compare the Cell Validation data with the Clip board item.

    But I am sure it's very hectic one or it may not be possible also

  5. #5
    Registered User
    Join Date
    05-30-2014
    Posts
    23

    Re: How to write code to restrict the copy-paste if sheet is having more than one drop-dow

    Hi

    can you please check with other forum members please...


    Thanks
    Mounika

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: How to write code to restrict the copy-paste if sheet is having more than one drop-dow

    hi timmu, if your data validation range is A1:D1, option with message and clearing content of the wrong validated cell value

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    05-30-2014
    Posts
    23

    Re: How to write code to restrict the copy-paste if sheet is having more than one drop-dow

    Hi watersev,

    Thanks for your valuable suggestion!!

    Actually my range is very large it includes A1:A500 , B1:B500 , C1:C500 and D1:D500. So , I created a Named Range called ValidationRange that includes all these .

    The code is working fine but my concern is if we copy in bulk suppose from A10 to D14 then we will get the error message pop-up 24 times and in case of huge bulk copy pop-up will pop 500 times which is not user friendly , so i used the code you said earlier like below:

    Now ,it is popping up only once just giving the First cell address i.e.., A10 but not the remaining , is it possible to modify this code further to make it user friendly .. please let me know if we can , thanks for the help.

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: How to write code to restrict the copy-paste if sheet is having more than one drop-dow

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to write a code within a loop to copy and paste rows on to another Sheet
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-24-2014, 08:40 PM
  2. How to restrict copy paste in drop down list?
    By Parwez in forum Excel General
    Replies: 5
    Last Post: 03-19-2013, 08:46 AM
  3. Code to write formula in 2 cells, copy, paste values, repeat next row until end of sheet
    By Oly Steel Man in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-14-2013, 11:13 AM
  4. [SOLVED] To restrict copy and Paste in worksheet
    By flakedew in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-22-2012, 06:03 AM
  5. Restrict copy paste ability
    By wana be xl master in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2006, 03:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1