• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Lock cells after using vlookup


New Member

I am using two different workbooks - MainList which is the main sheet a all the items are locked and second workbook's name is say SampleData.
By using V lookup macro I have pasted data from MainList to SampleData and now I want to lock the cells so that they cannot be edited. I want the same macro to perform this function. How can it be done?


Marc L

Excel Ninja
Hi !​
Once your VBA code writes the result to the cell, it must set its Locked property to True
then its must protect the worksheet (see its Protection property).​
When a worksheet is protected, only the cells with their Locked property to False are editable …​