+ Reply to Thread
Results 1 to 7 of 7

Search Code Locking Column

  1. #1
    Registered User
    Join Date
    03-17-2017
    Location
    Hell
    MS-Off Ver
    2010
    Posts
    172

    Search Code Locking Column

    Hello,

    I have this code to search the workbook when entering text or amount in cell N4. It searches and lists all occurrences that match fine when the workbook is unprotected. I set the column 'P' to be unlocked but when running a search it locks the column cells and results in debug when running it again.

    Can someone please see if there is a way to keep column 'P' cells from being locked?

    Thank you,
    Joe

    Please Login or Register  to view this content.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Search Code Locking Column

    Hi,

    Replace .Clear with .ClearContents (or .Value = vbNullString)
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    03-17-2017
    Location
    Hell
    MS-Off Ver
    2010
    Posts
    172

    Re: Search Code Locking Column

    Thank you for the reply. Just to be sure what would be the whole code change?

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Search Code Locking Column

    Please Login or Register  to view this content.
    I also added some code to prevent recursion due to changing cells inside a change event.

  5. #5
    Registered User
    Join Date
    03-17-2017
    Location
    Hell
    MS-Off Ver
    2010
    Posts
    172

    Re: Search Code Locking Column

    I replaced the code but no results are found now.

    Can you take a look please?

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Search Code Locking Column

    Your input cell is N3 and not N4 which is why the code is not doing anything.

  7. #7
    Registered User
    Join Date
    03-17-2017
    Location
    Hell
    MS-Off Ver
    2010
    Posts
    172

    Re: Search Code Locking Column

    So sorry for the trouble. I am storing this file on OneDrive and did updates at home this morning. For some reason those changes didn't come through on my work computer. I will have to look into this today.

    Thanks for the great help!

+ 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] Vba code to search key words in descriptions column
    By xlhelp7 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-18-2017, 02:37 AM
  2. Replies: 10
    Last Post: 08-05-2016, 07:31 AM
  3. Replies: 5
    Last Post: 01-06-2015, 06:51 AM
  4. [SOLVED] Search a column and code all rows with matching value in another column
    By lazypony in forum Excel Formulas & Functions
    Replies: 37
    Last Post: 08-03-2013, 11:23 AM
  5. [SOLVED] VBA code to search in a column and mark in another.
    By Anka in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-27-2012, 06:58 PM
  6. please help me with a code to search a list of files in column A to folder
    By khan.washik in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-25-2012, 10:34 PM
  7. Locking cells and amend search field
    By stewart1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2010, 05:01 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