+ Reply to Thread
Results 1 to 14 of 14

to define mandatory cell in excel before save file

  1. #1
    Registered User
    Join Date
    06-28-2019
    Location
    us
    MS-Off Ver
    2016
    Posts
    14

    to define mandatory cell in excel before save file

    hi dears
    i have a table in excel that column A to H for each row must fill daily by various Personnel
    now i need to write a VBA code that if rows of column A filled, personnel could not Save the file and show a message box for example " you must fill cells to column H" till other rows to H fill
    i need to code for all worksheet and for rows that add daily.
    tanQ

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,806

    Re: to define mandatory cell in excel before save file

    Place this macro in the code module for ThisWorkbook. Do the following: Hold down the ALT key and press the F11 key. This will open the Visual Basic Editor. In the left hand pane, double click on "ThisWorkbook". Copy/paste the macro into the empty window that opens up. Close the window to return to your sheet.
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    06-28-2019
    Location
    us
    MS-Off Ver
    2016
    Posts
    14

    Re: to define mandatory cell in excel before save file

    Mumps1,

    tanQ so much
    if i want to run it for one sheet only in my file, what could i do?
    Last edited by jeffreybrown; 06-28-2019 at 12:49 PM. Reason: Please do not use full quotes.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,806

    Re: to define mandatory cell in excel before save file

    What is the name of the one sheet?

  5. #5
    Registered User
    Join Date
    06-28-2019
    Location
    us
    MS-Off Ver
    2016
    Posts
    14

    Re: to define mandatory cell in excel before save file

    Quote Originally Posted by Mumps1 View Post
    What is the name of the one sheet?
    the name is THK

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,806

    Re: to define mandatory cell in excel before save file

    Try:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-28-2019
    Location
    us
    MS-Off Ver
    2016
    Posts
    14

    Re: to define mandatory cell in excel before save file

    [QUOTE=Mumps1;5145330]Try:
    Please Login or Register  to view this content.
    [/QUOTE
    it dose not work

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,806

    Re: to define mandatory cell in excel before save file

    How does it not work? Are you getting and error message and if so, what is the message and which line of code is highlighted when you click "Debug"? It would be easier to test the macro if you could attach a copy of your file.

  9. #9
    Registered User
    Join Date
    06-28-2019
    Location
    us
    MS-Off Ver
    2016
    Posts
    14

    Re: to define mandatory cell in excel before save file

    Quote Originally Posted by Mumps1 View Post
    How does it not work? Are you getting and error message and if so, what is the message and which line of code is highlighted when you click "Debug"? It would be easier to test the macro if you could attach a copy of your file.
    there is no error but i could save the file before fill cell B to H
    i can't attach the file here but because attachment is disable for me but can email it

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,806

    Re: to define mandatory cell in excel before save file

    To attach a file, click on the "Go Advanced" button. Scroll down a bit and click "Manage Attachments".

  11. #11
    Registered User
    Join Date
    06-28-2019
    Location
    us
    MS-Off Ver
    2016
    Posts
    14

    Re: to define mandatory cell in excel before save file

    Quote Originally Posted by Mumps1 View Post
    To attach a file, click on the "Go Advanced" button. Scroll down a bit and click "Manage Attachments".
    file has been attached
    Attached Files Attached Files

  12. #12
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,806

    Re: to define mandatory cell in excel before save file

    You have the macro in the wrong place. You have it in the code module for the worksheet. It should be in the code module for ThisWorkbook. Please follow the instructions I described in Post #2.

  13. #13
    Registered User
    Join Date
    06-28-2019
    Location
    us
    MS-Off Ver
    2016
    Posts
    14

    Re: to define mandatory cell in excel before save file

    Quote Originally Posted by Mumps1 View Post
    You have the macro in the wrong place. You have it in the code module for the worksheet. It should be in the code module for ThisWorkbook. Please follow the instructions I described in Post #2.
    Hi again
    In one worksheet i have a table with 3 column ABC column A is text that fill manualy B is number fill with vlookup and C is percentage of column B so beacuse of some row column B is zero i need to export a new table in column E to G that only show the row of previous table that column B is greater than zero to define a series by offset and count to draw a pie chart
    So i need a VBA to copy and paste rows that have value in column B greater than zero in column E To G

  14. #14
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,806

    Re: to define mandatory cell in excel before save file

    Since this is an entirely different question, according to Forum rules, you should start a new tread.

+ 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. [SOLVED] Help w/ Making Cell Mandatory - How to Save Blank Template
    By GregStewartPTC in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-04-2017, 03:06 PM
  2. mandatory cells only if another cell is filled - excel
    By Marty1234 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-20-2017, 02:30 PM
  3. Preventing Save Function Until Mandatory Fields Are Completed
    By narikisas in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-26-2015, 02:55 PM
  4. 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
  5. Save file using cell references & mandatory cell input
    By Plantation in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-22-2013, 12:46 PM
  6. Code to mark mandatory fields before save
    By ukhellfire in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-21-2013, 07:28 AM
  7. Replies: 0
    Last Post: 05-20-2011, 03:26 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