+ Reply to Thread
Results 1 to 17 of 17

Mandatory fields, and lock rows when complete

  1. #1
    Registered User
    Join Date
    03-16-2020
    Location
    Nairobi, Kenya
    MS-Off Ver
    Office 2016
    Posts
    24

    Mandatory fields, and lock rows when complete

    Dear Excel Community,
    I am working on a small person project using Excel VBA.
    I got this Idea from a youtube profile. the video is called Using Invoice Template to Automate Invoice Creation and Printing with VBA by Dinesh Kumar Takyar

    I have tried but failed to acquire what I wanted hence have come here for assistance.

    I have an Excel workbook which is a receipt (named receipt) while another workbook is the data entry (named Testing). (I have them attached)

    Basically what happens is that in the "Testing document, I enter data and when I Click Print, the data will go to the Receipt workbook, Save the receipt as defined in VBA and take it to the Printer. once this action has taken place, a DONE will be written at the end of the Row in the Testing workbook

    I want to now achieve 2 things

    1: I would like all the all the fields in the Testing workbook to be mandatory that will then allow me to print
    2: I would like that when the row has its last Column "DONE" that it gets locked so no one can edit it late.

    I hope to get the assistance in that. and appreciate the help I get.

    Below are are current VBA codes i have used

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by 6StringJazzer; 03-16-2020 at 07:37 AM. Reason: Moderator added code tags, fixed title

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Mandatory fields, and lock rows when complete

    With this modification, you'll be able to Print only completed receipts and lock those that are DONE.

    To lock cells, you must protect the sheet. You can use a password or none.
    By default, all cells are locked so you need to select all the cells in the sheet and go to the Format cells menu to change the protection. Unclick the Locked square.
    Then protect your sheet.
    Then run your macro.
    Please Login or Register  to view this content.
    In your receipt, you are now limited to 2 items, you have to use more columns in Test so you can have place more then 2 items.
    I hope this will help you.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    03-16-2020
    Location
    Nairobi, Kenya
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: Mandatory fields, and lock rows when complete

    thank you for the response.

    Please note, the DONE comes when you click the print.
    if the ROW has the DONE, it wont print.

    I tried to use the codes you sent and it failed.

    Kindly assist through sending a workbook

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Mandatory fields, and lock rows when complete

    There you are.
    The sheet is protected without a password.
    All the cells are UNLOCKED but the ones marked DONE which were LOCKED by the macro.

    The workbook has been modified to skip uncomplete orders and to protect (LOCK) all the rows with completed orders.

    Pierre
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-16-2020
    Location
    Nairobi, Kenya
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: Mandatory fields, and lock rows when complete

    Dear Pierre,

    I am so thankful for this assistance. this is what I exactly wanted to achieve.

    however 1 question/ altercation

    I see that if the row has missing entries then it wont print.

    however, not all will need to be filled take example the column of "Item 2" "unit price 2" "Quantity 2"

    I put those because if a person has 2 items then can add the details in the above named columns

    but if the person has only 1 item then i cannot print leaving the above named columns empty.

    hence could it be possible to have only some columns as mandatory and not all?

    Thank you
    Last edited by NirajB; 03-18-2020 at 07:13 AM. Reason: addition

  6. #6
    Registered User
    Join Date
    03-16-2020
    Location
    Nairobi, Kenya
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: Mandatory fields, and lock rows when complete

    Dear Pierre,

    I tried this in a new workbook. but now after executing the 1st, it protects all. and i cannot type again in the 2nd.

    could you check and assist because I copied your VBA codes
    Attached Files Attached Files

  7. #7
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Mandatory fields, and lock rows when complete

    with this modification, the mandatory fields are columns 1, 2, 3, 4, 5, 6, 8 and 10.
    Please Login or Register  to view this content.
    As you mentioned that you tested this on a new workbook, don't forget to UNLOCK all cells as per default they are all LOCKED. That probably explain your issue.
    Attached Files Attached Files
    Last edited by p24leclerc; 03-18-2020 at 10:15 AM.

  8. #8
    Registered User
    Join Date
    03-16-2020
    Location
    Nairobi, Kenya
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: Mandatory fields, and lock rows when complete

    Thank you Mr Pierre,
    I have now Understood the codes and can apply them.

    One last Query.
    to Edited the locked cells, i wish to have it with a password

    how would you suggest to do this?

  9. #9
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Mandatory fields, and lock rows when complete

    In the Review menu, when you click on Protect sheet, it will ask you for a password. You'll be asked to enter it twice.
    If the menu is saying "UnProtect sheet", that's because the sheet is already protected (as the one I modified).
    You enter your password there and you'll be able to modify protected cells.

  10. #10
    Registered User
    Join Date
    03-16-2020
    Location
    Nairobi, Kenya
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: Mandatory fields, and lock rows when complete

    Dear Mr Pierre,

    I am so grateful for all your assistance in making me achieve this. following all your methods, I went on and started it afresh and happy to report it all worked to expections.
    I am very thankful for you asssitance in helping.

    Thank you.
    hopefully if I have more queries, I will ask for assistance.

  11. #11
    Registered User
    Join Date
    03-16-2020
    Location
    Nairobi, Kenya
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: Mandatory fields, and lock rows when complete

    Is there a way to do this Just in VBA?

    the idea of "Const PW As String"

  12. #12
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Mandatory fields, and lock rows when complete

    if you mean protecting and unprotecting worksheets, yes, it can be done with VBA.

  13. #13
    Registered User
    Join Date
    03-16-2020
    Location
    Nairobi, Kenya
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: Mandatory fields, and lock rows when complete

    Thanks.
    I'll keep it simple for now. otherwise my colleagues will get confused.

  14. #14
    Registered User
    Join Date
    03-16-2020
    Location
    Nairobi, Kenya
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: Mandatory fields, and lock rows when complete

    Dear Pierre

    As I continue to Develop this Mini-Project, I came across Searchable dropdown Lists from youtube

    Create a searchable drop down list in Excel By Neil Firth

    Create a searchable drop down list in Excel Part 2 by Neil Firth

    Now, I have applied this to the workbook

    however, when I close the workbook and reopen it, the Functionality of this based on the videos fails to work

    I have used 2 sheets for this.

    Could you have a look at it and possible assist or have a solution to it?

    I have attached the workbook
    Attached Files Attached Files
    Last edited by NirajB; 03-23-2020 at 04:41 AM.

  15. #15
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Mandatory fields, and lock rows when complete

    it will be a pleasure to look into this but it can't be done on this thread.
    As per the rules, you must create a new thread because this is a new topic.

  16. #16
    Registered User
    Join Date
    03-16-2020
    Location
    Nairobi, Kenya
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: Mandatory fields, and lock rows when complete

    i have created a new discussion, please look at it. thank you

  17. #17
    Registered User
    Join Date
    03-16-2020
    Location
    Nairobi, Kenya
    MS-Off Ver
    Office 2016
    Posts
    24

    Re: Mandatory fields, and lock rows when complete

    Quote Originally Posted by NirajB View Post
    Dear Pierre,

    I tried this in a new workbook. but now after executing the 1st, it protects all. and i cannot type again in the 2nd.

    could you check and assist because I copied your VBA codes
    Dear Pierre,
    so far everything has gone well in this mini project.
    there is one issue. when I click on the print the printing from row 1 to row 2 and next is too fast.
    how can i cause a delay of 5-10 seconds between the printings?

+ 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. mandatory complete other cells if one cell is compleated
    By Bogdanmartin1988 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-18-2016, 10:28 PM
  2. [SOLVED] How can I make a certain cell in a sheet mandatory for a user to complete
    By ramatthews in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-08-2015, 03:13 PM
  3. VBA code for mandatory cells - only allow to save if complete
    By sqinm in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-06-2014, 11:19 PM
  4. VBA - Help With Mandatory Fields
    By crayhons in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 06-26-2013, 01:07 PM
  5. Mandatory field required message when user skips mandatory fields
    By Bharathi27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2013, 05:12 AM
  6. Mandatory Fields
    By i82 in forum Excel General
    Replies: 1
    Last Post: 09-13-2012, 05:13 AM
  7. Hiding rows on cell content and mandatory fields
    By MagicMan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-08-2011, 06:07 AM

Tags for this Thread

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