View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Otto Moehrbach Otto Moehrbach is offline
external usenet poster
 
Posts: 1,090
Default Workbook close event

Perhaps something like this: HTH Otto
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With Sheets("TheShtName")
Set Rng = .Range("A1", .Range("A" & Rows.Count).End(xlUp))
End With
If Rng.Count Application.CountA(Rng) Then
MsgBox "Some empty cells."
Cancel = True
End If
End Sub

"kpriyac" wrote in
message ...

Hi,

I need to add validation which sees if any of the cells in a column are
empty. If yes, then I need to show a message to the user.

I need to write this dynamically in VB.net depending on the number of
rows.
How do I do this?

KPC


--
kpriyac
------------------------------------------------------------------------
kpriyac's Profile:
http://www.excelforum.com/member.php...o&userid=37535
View this thread: http://www.excelforum.com/showthread...hreadid=573077