+ Reply to Thread
Results 1 to 6 of 6

Macro to unlock cells in particular columns based on header value

  1. #1
    Registered User
    Join Date
    11-16-2013
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Macro to unlock cells in particular columns based on header value

    Hello

    My knowledge of macros is almost zero.

    I need a very simple macro that will perform the following:
    column range ( I6:AM326 ) where the row 5 is the header. I need to open cells in rows 7 to 326 of columns with header values (-1 ) and /or ( 0) unlocked
    for data entry.
    **These header values change daily on the basis of Today ( ) function in some other cell*

    However I don' t want this macro to alter or affect any other cells in the whole worksheet.
    Also I should be able to copy the work sheet and the VBA code also moves with the copy. I dont want the VBA code to be in a seperate module
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,881

    Re: Macro to unlock cells in particular columns based on header value

    This macro should do what you want. I don't know of any way to copy and move the worksheet along with the macro. You may have to copy macro separately.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-16-2013
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Macro to unlock cells in particular columns based on header value

    hi Mumps
    Thanks for the help.
    But the code doesnt seem to work.
    Please have a look at the attached example
    Attached Files Attached Files

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,881

    Re: Macro to unlock cells in particular columns based on header value

    You had placed the macro in the worksheet code module and in the ThisWorkbook code module. It should have gone in a regular module. Secondly, you had used several merged cells. Merged cells most often confuse Excel so you should avoid them if at all possible. I have unmerged the cells and place the macro in a regular module. Just click the "Update" button to unlock the appropriate columns. See the attached file.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-16-2013
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Macro to unlock cells in particular columns based on header value

    OK Mumps , it works. But not password protected. Can we re-write the code with password protection ? pwd " " ?
    Thanks in advance
    Napa

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,881

    Re: Macro to unlock cells in particular columns based on header value

    Hi Napa. Here is the revised code. Just replace "password" with the password you used to protect the worksheet (two occurrences).
    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. Lock and unlock cells based on value
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-15-2016, 04:53 AM
  2. [SOLVED] Macro to delete columns based on header
    By sfadam in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-25-2015, 05:15 PM
  3. Replies: 2
    Last Post: 10-13-2012, 03:30 AM
  4. unlock cell based on another cells input
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-06-2009, 02:18 AM
  5. Macro to rearrange/add columns based on column header?
    By drdavidge in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2006, 09:35 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