+ Reply to Thread
Results 1 to 15 of 15

How to contorl drag and drop function for a particular xls

  1. #1
    Registered User
    Join Date
    11-07-2006
    Posts
    4

    How to contorl drag and drop function for a particular xls

    Dear Forum,

    I have created one xlt and i have used different macros and funtions in that.

    And aslo i have used functions like COUNTA using cell reference. Hence if we use move operation into a cell which refernced in the fuction, then it is giving an error.

    In the fuction '#REF!' is coming in place of that cell reference

    As i want use this in differnet machines, i cant disable the drag and drop function using Tools -> Options.

    Can anybody give me a solution on the above problem.

    Thanks in advance


    Best Regards,
    Arun V. Mohan

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    To get a precise answer, could you be kind enough to share with us the Counta() formula which is giving you problems ...

    Carim

  3. #3
    Registered User
    Join Date
    11-07-2006
    Posts
    4
    I wrote the function as COUNTA(B80,K80,T80,AC80,AF80,AJ80,AN80,AQ80)

    When I moved One Cell to the Cell B80 then the function is showing as COUNTA(#REF!,K80,T80,AC80,AF80,AJ80,AN80,AQ80).


    So i would like to disable the drag and drop operation.

    Best Regards,
    Arun V. Mohan

  4. #4
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Could you have in cell B80

    = sourcecell ?

    Carim

  5. #5
    Registered User
    Join Date
    11-07-2006
    Posts
    4
    hi,

    Actually i want to restrict drag and drop function only in my xlt.

    so could you please give any idea in that.


    Best Regards,
    Arun V. Mohan

  6. #6
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Protect your cells and then Protect your sheet ...

    HTH
    Carim

  7. #7
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon arunvmohan

    An alternative approach to protecting the sheet :

    Please Login or Register  to view this content.
    The above code, to be placed in the ThisWorkbook module of the VBE will suppress the drag-and-drop functionality.

    HTH

    DominicB

  8. #8
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Thanks DominicB !!!

    I did not know this instruction ...

    Cheers
    Carim

  9. #9
    Registered User
    Join Date
    11-07-2006
    Posts
    4
    Thnks Mr. DominicB.

    It is working. Can we control copy and paste also in that way?

    Mr. Carim thnks for ur help also.

    Best Regards,
    Arun V. Mohan

  10. #10
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi arunvmohan

    Alas no! T'would be nice if you could. It is possible to do via VBA but there is no single instruction to do so - you have to disable menu items, toolbar icons and shortcut keys. Ivan F Moala has provided a nice routine on his oages to do (and undo) this for you :

    http://www.xcelfiles.com/VBA_Quick13.html

    HTH

    DominicB

  11. #11
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    If I may add a word of caution to Dominicb's excellent suggestion ...

    Given your situation, where you are providing your worksheet to many other users, you have to be very careful when manipulating XL command bars, because your users could easily find themselves lost and stuck with their own XL no longer operating "the usual way" ...

    HTH
    Carim

  12. #12
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi Carim

    I gave up giving that kind of advice a while ago. Why? 'Cos people don't listen and just go ahead and do it anyway. I always try and avoid changing the front end drastically in any apps I put together as people can always mess up a spreadsheet no matter what "safeguards" you put up and if someone is determined enough can circumvent Excel's protection anyway.

    All the same, sound advice Carim ...

  13. #13
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Hi arunvmohan

    With Carim's warning words ringing in my ears, I've just had another thought ...

    A while ago I wrote a short routine for a question posted on another board I answered. This routine basically checked the clipboard every x seonds and emptied it if there was anything there. Somebody wanted to prevent a user doing print screens and there doesn't seem to be a way of doing this.

    This routine would achieve the result you wanted without compromising you menu structure. If you are interested I'll try and dig it out ...

    HTH

    DominicB

  14. #14
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi Dominicb,

    I already knew from your posts that you were a wise and experienced person ...
    In addition you are right, based on my experience too, people do not listen to such warnings ... (shame...)


    Cheers
    Carim

  15. #15
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,927
    Here's a thought that should solve the original problem, but may create a whole host of new problems.

    The problem is that, when you cut and paste (or move) cells around, Excel tries to figure out what to do with cell references. Sometimes it doesn't do so well. Using the INDIRECT function blocks Excel from trying to correct references. So:
    =COUNTA(INDIRECT("B80"),INDIRECT("K80"),...) would allow someone to cut and paste over those references without causing the reference error.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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