+ Reply to Thread
Results 1 to 10 of 10

I need to adjust VBA file that locks cell after a date by 3 lines

  1. #1
    Forum Contributor
    Join Date
    12-30-2021
    Location
    Mount Gambier, Australia
    MS-Off Ver
    19
    Posts
    108

    I need to adjust VBA file that locks cell after a date by 3 lines

    I have a VBA code that locks cells in a column once today reaches a date.

    Ie on the Amort Tab

    The cells in Column J lock after The date in Cell D5 (TODAY()) passes the date in Column C.

    for example:
    Cell J44 would lock after D5 (TODAY()) passes C44 (yesterday)

    Current VBA
    Please Login or Register  to view this content.
    It currently locks at cell J41
    Attached Files Attached Files

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: I need to adjust VBA file that locks cell after a date by 3 lines

    Worksheet_change even works for input change only, not formula.
    cell D5 contains formula, it will not be fired automatically with new day.
    2 options:
    1) Put code in Worksheet_calculate even. It may reduce the speed.
    2) Put code in worksheet_active even.

    P/S: You said column J, but in code, refer to column I. What is correct?
    Quang PT

  3. #3
    Forum Contributor
    Join Date
    12-30-2021
    Location
    Mount Gambier, Australia
    MS-Off Ver
    19
    Posts
    108

    Re: I need to adjust VBA file that locks cell after a date by 3 lines

    Quote Originally Posted by bebo021999 View Post
    Worksheet_change even works for input change only, not formula.
    cell D5 contains formula, it will not be fired automatically with new day.
    2 options:
    1) Put code in Worksheet_calculate even. It may reduce the speed.
    2) Put code in worksheet_active even.

    P/S: You said column J, but in code, refer to column I. What is correct?
    Hi

    Column J is the correct column.

    I have no idea about VBA and I don't understand it. Someone on here wrote it for me but I had to change the sheet around.

  4. #4
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: I need to adjust VBA file that locks cell after a date by 3 lines

    Right click in sheetname (Amort) / view code/ choose worksheet then activate (from 1 to 4 in the image)

    P/S: attachment included
    Attached Images Attached Images
    Last edited by bebo021999; 02-11-2022 at 04:54 AM.

  5. #5
    Forum Contributor
    Join Date
    12-30-2021
    Location
    Mount Gambier, Australia
    MS-Off Ver
    19
    Posts
    108

    Re: I need to adjust VBA file that locks cell after a date by 3 lines

    says Invalid Attachment specified. If you followed a valid link, please notify the administrator

    can you just post the code please

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: I need to adjust VBA file that locks cell after a date by 3 lines

    Quote Originally Posted by wildecoyote1966 View Post
    says Invalid Attachment specified. If you followed a valid link, please notify the administrator
    can you just post the code please
    Attchment was provided in that post.

  7. #7
    Forum Contributor
    Join Date
    12-30-2021
    Location
    Mount Gambier, Australia
    MS-Off Ver
    19
    Posts
    108

    Re: I need to adjust VBA file that locks cell after a date by 3 lines

    Quote Originally Posted by bebo021999 View Post
    Attchment was provided in that post.
    I did that and still exactly the same
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    12-30-2021
    Location
    Mount Gambier, Australia
    MS-Off Ver
    19
    Posts
    108

    Re: I need to adjust VBA file that locks cell after a date by 3 lines

    Can anyone fix this for me please?

  9. #9
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,481

    Re: I need to adjust VBA file that locks cell after a date by 3 lines

    Quote Originally Posted by wildecoyote1966 View Post
    I did that and still exactly the same
    No, you did not.
    It still under "General" and "Declerations".
    In General, choose "Worksheet" and in "Declerations" choose "calculate".

  10. #10
    Forum Contributor
    Join Date
    12-30-2021
    Location
    Mount Gambier, Australia
    MS-Off Ver
    19
    Posts
    108

    Re: I need to adjust VBA file that locks cell after a date by 3 lines

    Quote Originally Posted by bebo021999 View Post
    In General, choose "Worksheet" and in "Declerations" choose "calculate".
    Still the same
    Attached Files Attached Files

+ 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. Create File for each date - Ignore lines with #N/A or blanks
    By snuffnchess in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-21-2021, 07:21 AM
  2. Replies: 1
    Last Post: 05-23-2020, 06:46 PM
  3. [SOLVED] Shared file locks for saving when a specific macro is run
    By Sleepyshy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-01-2013, 04:37 PM
  4. Excel locks up when importing file w/macro.
    By Jim15 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-05-2009, 08:37 AM
  5. file locks up
    By NewTooExcel in forum Excel General
    Replies: 3
    Last Post: 08-03-2007, 07:05 PM
  6. Replies: 1
    Last Post: 12-15-2005, 07:55 PM
  7. Need to look at vba code in a file but excel locks up each time I
    By SKelley in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-04-2005, 11:06 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