+ Reply to Thread
Results 1 to 22 of 22

Disable entry if autofilter is on

  1. #1
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Disable entry if autofilter is on

    I have a list which, when filtered, I do not want the user to be able to add a line to the bottom of (as this mucks up when the list filter is removed)

    how do i code it so that the user is forced to unfilter all so that they can then add a line to the bottom of said list?

    Example list attached. I do not want the user to be able to type anything in row 23 for example, but only when the filter has been removed completely can the user do so...


    Book2.xlsx
    Last edited by nickmax1; 10-08-2013 at 12:20 PM.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Disable entry if autofilter is on

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    john that doesnt seem to do anything?

  4. #4
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    do i need to put something into the "" after target.value?

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Disable entry if autofilter is on

    The code goes into the specific Sheet Event Module. The user won't be able to make an entry if the Filters are on. I thought that was what you wanted. The code worked when I tested it.

  6. #6
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    I get an error when putting it into the sheet event module (not enough memory to display properly)

    Instead of disabling could you change to disabling and a msgbox telling the user to unfilter?

    IS there any way I can put this in the ThisWorkbook so I can get it to work for all sheets?


    EDIT: 2nd time i run it I get another error "method value of object range failed" referring to the target value line.
    Last edited by nickmax1; 10-09-2013 at 06:23 AM.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Disable entry if autofilter is on

    I can't duplicate your errors from your sample. For the msgbox. Goes in the ThisWorkbook - Workbook - Workbook_SheetChange Event

    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    great - i get no errors there - the user still can technically enter text though, despite the warning.

    I was wondering if there was a way that if the filter was on, the range below the filtered content (call it A (whatever the last filtered row was) to A:195) to be locked so that nothing could be entered, and then when the filter is removed the locked cells would all be too...

  9. #9
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    does my last reply make sense, so that the rows immediately after the filtered content up to and including row 195 are locked so noone can enter any data there (and maybe a msgbox pop up saying so) and then the only way to unlock that range is to unfilter?

  10. #10
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Disable entry if autofilter is on

    It's doable. However, it would involve passwords, and protecting the sheet? A bit more complicated. I was trying to find a work around. I don't think you'd want each user to have a password? Wouldn't that defeat the purpose?

  11. #11
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    could u not have the password inbuilt into the macro, so that the autofilter being ON turns the lock state (and password) on, and undoing the filter turns the Lock state and password off?

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Disable entry if autofilter is on

    Maybe you can experiment with this to get the desired result.

    Please Login or Register  to view this content.

  13. #13
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    again that doesnt seem to do anything, is the protection on properly in that code? I am placing this in YourWorkbook...

  14. #14
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    any ideas?

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

    Re: Disable entry if autofilter is on

    hi nickmax1, please check attachment, try to add value in row 23 and remove filter. It does not use any VB
    Attached Files Attached Files

  16. #16
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    watersev,
    I dont understand, I am perfectly able to edit row 23 with filters on?

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

    Re: Disable entry if autofilter is on

    maybe I got you wrong, what is the problem if you enter data in row 23 and remove filter on B column?

  18. #18
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    there is no problem - which is the problem!!
    if there is an autofilter applied the user should NOT be able to edit any rows below the filtered range...only when the autofilter is deselected should the user be able to do so.

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

    Re: Disable entry if autofilter is on

    try this out
    Attached Files Attached Files

  20. #20
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    ooh that is clever....

    How do i get this to work in my ThisWorkbook so that it runs on any sheet?

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

    Re: Disable entry if autofilter is on

    please check attachment
    Attached Files Attached Files

  22. #22
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Disable entry if autofilter is on

    watersev that works brilliantly,

    how do i merge that with my current event_change?

    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 disable AutoFilter
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-06-2013, 12:46 AM
  2. Disable AutoFilter Sort?
    By incjourn in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-23-2009, 09:11 AM
  3. Disable AutoFilter function for specific rows
    By ebneterc in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-19-2007, 08:33 AM
  4. NEED HELP - How to disable a cell to restrict data entry
    By Sriram in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-18-2006, 10:50 AM
  5. [SOLVED] Disable hyperlinks on entry
    By Barb Reinhardt in forum Excel General
    Replies: 1
    Last Post: 08-23-2005, 10:05 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