+ Reply to Thread
Results 1 to 2 of 2

Vlookup Question; VBA Code to Lock Cells

  1. #1
    Registered User
    Join Date
    10-10-2015
    Location
    Friday Harbor, WA
    MS-Off Ver
    Excel 2013
    Posts
    5

    Vlookup Question; VBA Code to Lock Cells

    Dear Members,
    I have a spreadsheet that I use to track cost and depreciation expense for assets placed in service. The user selects an Item ID from the inventory drop down list, then assigns it an internally generated serial number. The item description and corresponding cost fields are autofilled using a Vlookup formula. Once this new item is saved, the spreadsheet starts calculating monthly depreciation expense. My problem is this, annually I update the Item ID list which may change the cost for some of the items put into service during prior years. For example: if in year one the cost of an item is $8,400.00. In year two the the company's new cost for this item may be $10,000.00.
    Question: How do I keep the original cost for the item from year one in the cell, $8,400.00, when the value in the inventory table, that the Vlookup formula references, gets update to the new value of $10,000.00 in year two? I'm using the following code to keep date previously entered from being changed after the data is entered and saved:

    Please Login or Register  to view this content.
    Thank you in advance for any help you can provide!
    Last edited by midfielder1; 04-23-2023 at 01:04 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,747

    Re: Vlookup Question; VBA Code to Lock Cells

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. Replies: 0
    Last Post: 05-30-2019, 12:13 PM
  2. Code to Lock Certain Cells
    By gediminasfx in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 04-02-2019, 05:11 PM
  3. [SOLVED] Hidding vba code and lock cells??
    By Ronni1991 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-28-2017, 03:09 PM
  4. Lock cells so they cannot be deleted by other VBA code
    By ThisGuyJohnny in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-31-2017, 08:31 PM
  5. VBA Code to lock and unlock cells.
    By gerald6126 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-26-2013, 03:08 PM
  6. How to lock header cells in the following code
    By gamaz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-29-2009, 05:59 PM
  7. Lock cells based on value of other cells - code simplification query
    By glenin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-07-2009, 03:11 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