+ Reply to Thread
Results 1 to 7 of 7

Event Change code to protect formula if data entered manually

  1. #1
    Registered User
    Join Date
    04-03-2014
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    4

    Event Change code to protect formula if data entered manually

    I have a worksheet for formation evaluation that automatically inputs the "Top depth" based on the "bottom depth" of the previous formation. However, there are instances where the top depth needs to be manually entered, thus deleting the formula. I would like to keep this flexibility, but have it so the initial formula is retained and automatically input if the manual entry is deleted or the spreadsheet is used for another evaluation. Obviously I could just delete and scroll the formula above it down to cover, but I believe there is a way to write a VBA code to ID the event change and repopulate the deleted cell with the formula. Is this possible?

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Event Change code to protect formula if data entered manually

    Can you redact any sensitive information from your worksheet and attach it as an example?
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Registered User
    Join Date
    04-03-2014
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Event Change code to protect formula if data entered manually

    OK I think I attached correctly, sorry, I am noob to the forum.

    Anyway, I have a formula is column "c" which automatically populates the next "top depth" based on the previous "bottom depth", and if it's a new wellbore (sidetrack) it puts is a "0" as the new start point.

    I want to be able to leave column "c" available for manual input if need be (say if certain formation info is missing, or there is a gap in info that would require some footage to be skipped, etc.), but if the manual entry is deleted then it auto-populates the cell with the formula again.

    Thanks for the help
    Attached Files Attached Files

  4. #4
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Event Change code to protect formula if data entered manually

    Try this. I did it with a hidden "cheater" row in row 2. Solus Edit.xlsm

  5. #5
    Registered User
    Join Date
    04-03-2014
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Event Change code to protect formula if data entered manually

    Thanks Solus-

    When I copied your code over to my worksheet I noticed it doesn't revert back right away, you have to highlight the cell again for it to fill in (when I delete a manually entered number into "c#" and hit enter it stays blank, but when I select that cell again it auto-fills. Is this something I did wrong in copying over the code? Otherwise works great, and I did not notice this with the worksheet you attached, it fills in right away.

  6. #6
    Registered User
    Join Date
    04-03-2014
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Event Change code to protect formula if data entered manually

    OK nevermind I think I got it, I did not copy the "option explicit" over and just did the stuff in the middle. Seems to be working great now. Couldn't have done this myself so thank you very much.

  7. #7
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Event Change code to protect formula if data entered manually

    Glad to help. And welcome to the forum.

    Thank you for marking the thread as [SOLVED].

    On any thread you can show appreciation to those who have helped you by clicking the * below their post.

+ 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. Option to switch between formula and manually entered value in a cell.
    By lgass in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-28-2014, 04:20 PM
  2. Replies: 1
    Last Post: 12-22-2013, 04:43 AM
  3. A manually entered cell to automatically update another manually entered cell
    By Head Scratcher in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-29-2013, 08:23 PM
  4. How to make excel formula value act like a manually entered number
    By MOONDRIFT47 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-17-2012, 01:37 PM
  5. [SOLVED] Keeping manually entered data
    By Mike Punko in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-06-2005, 02:05 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