Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

VB or Macro code

0

Hi , I have a question regarding an excel template which we use in our office. We have created a simple template as a checklist for our process. For the same we need to fill up the details manually and save the same for official purpose. 

Before exiting the excel it should show what are the errors or missing field oto be entered in the excel in order to san=ve and close the file.

Is there any code to create the same if so please let me know which will be helpful for me to creat for the benifit of our team.

Thanks,

Sudharsan VG

Answer
Discuss

Answers

0

You haven't defined what an "error" is in this workbook, but the general functionality is very much possible.

You can certainly have a macro run when the user goes to close the workbook and that macro can check the cells to see if there is an empty one that shouldn't be empty or an error in the workbook.

Put your macro into ThisWorkbook

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    'Code goes here
End Sub

If you are totally lost at this point then you need to learn more about vba. 

You can start at the top of the tutorial list for VBA here: Macro/VBA Tutorials - the first 10 or so are in order for beginners.

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login