![]() |
validate cells
In Excel, how can I validate that a cell has data? If there are blank cells,
I would like a message box when the user clicks on file to save or send. Any help would be greatly appreciated. |
validate cells
You can use the Workbook_BeforeSave event.
In this event you put something like this if Sheet1.Cells(1,1).Value = "" then Cancel=True Endif "Tammy H" wrote: In Excel, how can I validate that a cell has data? If there are blank cells, I would like a message box when the user clicks on file to save or send. Any help would be greatly appreciated. |
validate cells
If IsEmpty(Sheet1.Cells(1,1)) then ...
Alok wrote: You can use the Workbook_BeforeSave event. In this event you put something like this if Sheet1.Cells(1,1).Value = "" then Cancel=True Endif "Tammy H" wrote: In Excel, how can I validate that a cell has data? If there are blank cells, I would like a message box when the user clicks on file to save or send. Any help would be greatly appreciated. |
validate cells
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Application.CountBlank(worksheets("Sheet1") _ .Range("A1:Z26")) 0 then msgbox "Blank Cells Exist" Cancel:=True end if End Sub Make the workbook a window, then right click on the blue border at the top and select view code. this is the ThisWorkbook module. Put in code like the above. However, What if the user is trying to close without saving? Anyway, change the sheet name and the specified range to be what you want to check. http://www.cpearson.com/excel/events.htm has general information on events - Chip Pearson's site. -- Regards, Tom Ogilvy "Tammy H" <Tammy wrote in message ... In Excel, how can I validate that a cell has data? If there are blank cells, I would like a message box when the user clicks on file to save or send. Any help would be greatly appreciated. |
All times are GMT +1. The time now is 12:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com