+ Reply to Thread
Results 1 to 14 of 14

Prevent save unless all cells or certain cells are filled in

  1. #1
    Registered User
    Join Date
    12-02-2007
    Posts
    5

    Prevent save unless all cells or certain cells are filled in

    Hi all.

    I have a spreadsheet that is emailed to someone to fill in. They then fill in some information and send it on to someone else.

    Sometimes they don't fill in all the information so is it possible to have excel check that cells are filled in and to prevent someone from saving unless this is so? Or maybe a message stating that the cells need to be completed if Excel is being closed or saved?

    First time on here. Any help would be greatly appreciated.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You will need VBA to achieve this. It depends what ranges need completing as to the actual code.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    To add to Roy's suggestion

    Code goes in this workbook (see link)

    http://www.contextures.com/xlvba01.html#Workbook

    Won't allow you to save until Sheets 1 cell B5 isn't blank

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Registered User
    Join Date
    12-02-2007
    Posts
    5
    Thanks for the code VBA Noob! I do not use VB and the example you gave is for 1 cell. How would you put additional cells in?

    Please Login or Register  to view this content.
    or?
    Please Login or Register  to view this content.
    Cheers

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Try

    Please Login or Register  to view this content.
    VBA Noob
    Last edited by VBA Noob; 12-02-2007 at 10:41 AM.

  6. #6
    Registered User
    Join Date
    12-02-2007
    Posts
    5
    Awesome! Thanks again for your help

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Assuming that you have locked all the cells except input cells & protected the sheet, then this code will check that all unlocked cells are complete, if not it stops with a message & selects the required cell.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-02-2007
    Posts
    5
    Thanks Roy for that. It's a little easier than inputting all the cells as at least now I can select the ones I want to unprotect on the sheet.

    They have now moved the goalposts however

    Now It's not for when the sheet is saved but instead it's for when the user prints to PDF format.

    Any ideas?

  9. #9
    Registered User
    Join Date
    02-19-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Prevent save unless all cells or certain cells are filled in

    Thank you very much Roy! This worked perfectly except I just realized it stopped working when i use unlocked merged cells as part of those that have to be filled. One option is to unmerge them so they don't give me trouble, but it would change a lot of the format I want. Would you have any suggestion on how to make it work for merged cells? Thank you!!

  10. #10
    Registered User
    Join Date
    12-27-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Prevent save unless all cells or certain cells are filled in

    I am useing office 2010 and it does not work when i try to save or save as.

  11. #11
    Registered User
    Join Date
    07-24-2014
    Location
    Chile
    MS-Off Ver
    2010
    Posts
    2

    Re: Prevent save unless all cells or certain cells are filled in

    Hi royUK

    Thats fantastic! thank you. Is there anyway that the specific cells that must be updated to allow the save can be modified automatically according to the date?

    I have a sheet that each day a number of different people enter details of sales etc for the day, but of course only details for that day. The next day the details of that day must be entered and so on.

    Thank you very much

    Richard

  12. #12
    Registered User
    Join Date
    07-24-2014
    Location
    Chile
    MS-Off Ver
    2010
    Posts
    2

    Re: Prevent save unless all cells or certain cells are filled in

    Hi royUK

    Thats fantastic! thank you. Is there anyway that the specific cells that must be updated to allow the save can be modified automatically according to the date?

    I have a sheet that each day a number of different people enter details of sales etc for the day, but of course only details for that day. The next day the details of that day must be entered and so on.

    Thank you very much

    Richard

  13. #13
    Registered User
    Join Date
    07-13-2015
    Location
    Bangalore
    MS-Off Ver
    2010
    Posts
    2

    Re: Prevent save unless all cells or certain cells are filled in

    Hello All,
    I have a file (attached), in which I want the user to get a msg "All Fields are not filled" when they are trying to close ir save the file. I need help in writing a macro.
    Requirement:- 1) In the file if the user fills the cell "R2" then he must fill the cell "S2" and "Y2".
    2) In the file if the user fills the cell "R2" then he must fill the cell "S2" and "Y2". Also, if the user selects "Closed" in cell "Y2" then user must fill "Z2". The remaining cells can be left blank.

    Please note that the user might not fill the cells in column "R". If the column "R" is empty then if the above mentioned cells are blank then user should not get the prompt that the "All Fields are not filled".
    Also, the sheet will be used by the user every day and on day 1 the user might reach till "R20"..and all the other cells in the column "R" might be blank.. similarly, on day 2 the user might reach till "R40" and the cells below that will be empty.
    Please let me know if you need more info on the requirement. Thank you in advance

    Regards,
    Shafi
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    04-29-2021
    Location
    NY, NY
    MS-Off Ver
    360
    Posts
    1

    Re: Prevent save unless all cells or certain cells are filled in

    Just wanted to say thanks and the info still helped in 2021

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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