+ Reply to Thread
Results 1 to 8 of 8

Code to disable fill handle and cell drag & drop for specific worksheet only

  1. #1
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    178

    Code to disable fill handle and cell drag & drop for specific worksheet only

    I have a worksheet (M1) that has an excel table where the user is able to enter data. I have another worksheet (Sheet1) that extracts data from this excel table. However, I discovered that if the user decides to use the table's fill handle on one of row cells to drag down a row as a way to auto populate a new date, the Sheet1 worksheet does not recognize this new row. Instead, it loses the row it once had with formulas.

    I am thinking that there may be a macro (or maybe a formula?) to do one of either two things:

    A. Disable the fill handle and cell drag & drop feature, but ONLY for the M1 worksheet, not for the other worksheets that might be in the workbook. This way, the user is forced to manually type in the date instead of trying to drag down a new date.

    B. Enable Sheet1 to recognize the new M1 row insert and not lose any of the rows with formulas.

    Are there any such solutions? I'd be very grateful if there is. I've already spent days writing up sheets that read from excel table entries and would hate to drop this project because of this problem.

    Please see the attached file and the MS word screenshot for further reference.
    Attached Files Attached Files

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Code to disable fill handle and cell drag & drop for specific worksheet only

    .
    https://www.ozgrid.com/forum/index.p...drag-and-drop/

  3. #3
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    178

    Re: Code to disable fill handle and cell drag & drop for specific worksheet only

    How do you write this code to deactivate the fill handle for this workbook only, not other workbooks?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,459

    Re: Code to disable fill handle and cell drag & drop for specific worksheet only

    It looks as though it's all already there. The Workbook.Activate and Workbook.DeActivate event handlers MUST go in the ThisWorkbook class module.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    178

    Re: Code to disable fill handle and cell drag & drop for specific worksheet only

    Thank you for your suggestions.

    I tried adding the code as best I can but apparently did not do it properly.

    Please try setting the code on this attached workbook so I can see where I went wrong.

    Thank you!
    Attached Files Attached Files

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Code to disable fill handle and cell drag & drop for specific worksheet only

    .
    See attached :
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    05-25-2019
    Location
    Sioux Falls, South Dakota
    MS-Off Ver
    Microsoft 365
    Posts
    178

    Re: Code to disable fill handle and cell drag & drop for specific worksheet only

    Logit, thank you for putting this together properly.

    Interesting that if any other workbook(s) are open at the same time as this one, then they also have their fill handles disabled. That'll still be fine for my purpose.
    I'm going to try and see if there's a way to prevent deletion or insertion of rows/columns as well.

  8. #8
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Code to disable fill handle and cell drag & drop for specific worksheet only

    .
    Use these macros instead :

    Please Login or Register  to view this content.

    Where ever there is the term Application ... it was replaced with ... ThisWorkbook.Application

+ 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. How to disable drag auto-fill, but allow drag shift-entire-row?
    By superlative in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-02-2019, 06:13 PM
  2. How to Control Drag and Drop? (force "shift" drag-drop, disable into certain rows)
    By superlative in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2019, 11:16 AM
  3. Replies: 1
    Last Post: 11-03-2018, 04:26 PM
  4. [SOLVED] Disable fill-handle-drag-and-drop via VBA
    By MarmaladeLover in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-26-2015, 07:10 AM
  5. Replies: 1
    Last Post: 07-06-2010, 06:06 PM
  6. Disable fill handle
    By sverhaeghe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-27-2009, 08:56 AM
  7. [SOLVED] What is keyboard shortcut equivalent to drag the fill handle
    By JZ in forum Excel General
    Replies: 2
    Last Post: 07-31-2006, 01:30 AM

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