Using Excel, let's say I have a spreadsheet with 6 columns of data, 4 of which are required. In database terms, these 4 columns make up my composite key.
(The column names above in bold are required.)
When the user saves the workbook, I would like to call VBA to check all rows that contain data to ensure that all 4 required columns are populated. If a row doesn't contain any data, the code doesn't have to run the check.
If the data checks correctly, the code can then save the workbook. If not, an error messagebox should appear.
I think I should be using the Workbook_BeforeSave event, but I'm not sure. I have a little bit of experience with VBA, but not much, so I welcome any and all suggestions.
Thank you.
Code:
[b]Branch Month Year Contract[/b] Salesperson Amount
101 9 2005 1234 Judy 100.00
When the user saves the workbook, I would like to call VBA to check all rows that contain data to ensure that all 4 required columns are populated. If a row doesn't contain any data, the code doesn't have to run the check.
If the data checks correctly, the code can then save the workbook. If not, an error messagebox should appear.
I think I should be using the Workbook_BeforeSave event, but I'm not sure. I have a little bit of experience with VBA, but not much, so I welcome any and all suggestions.
Thank you.