Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
j j is offline
external usenet poster
 
Posts: 2
Default 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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to validate input based upon values in two other cells JG Excel Discussion (Misc queries) 1 December 11th 09 05:49 PM
validate multiple cells in to one dropdown box shad Excel Discussion (Misc queries) 3 April 15th 07 10:02 PM
HOW DO I GET EXCEL TO VALIDATE TWO CELLS AT ONCE Christopher Gilbert Excel Discussion (Misc queries) 1 December 9th 05 11:32 PM
Validate cells have data WendyUK Excel Worksheet Functions 9 August 13th 05 01:33 AM
Validate Cells based on if conditions Supriya Excel Programming 1 February 2nd 04 06:18 AM


All times are GMT +1. The time now is 06:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"