Is there any way to require data entry into cells such that the
save/save as functions can be disabled until the data is entered?
Thanks,
Dan--
Dan Raab
------------------------------------------------------------------------
Dan Raab's Profile: www.excelforum.com/member.php...oamp;userid=29414
View this thread: www.excelforum.com/showthread...hreadid=499474You can use the BeforeSave event procedure to do this. In the
ThisWorkbook code module, use the following code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel
As Boolean)
If Worksheets(quot;Sheet1quot;).Range(quot;A1quot;) = quot;quot; Then
Cancel = True
End If
End Sub--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
quot;Dan Raabquot; gt;
wrote in message
news
gt;
gt; Is there any way to require data entry into cells such that the
gt; save/save as functions can be disabled until the data is
gt; entered?
gt;
gt; Thanks,
gt;
gt; Dan
gt;
gt;
gt; --
gt; Dan Raab
gt; ------------------------------------------------------------------------
gt; Dan Raab's Profile:
gt; www.excelforum.com/member.php...oamp;userid=29414
gt; View this thread:
gt; www.excelforum.com/showthread...hreadid=499474
gt;
Maybe....
Saved from a previous post:
Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim myRng As Range
Dim myEmptyRng As Range
Dim myCell As Range
Set myRng = Me.Worksheets(quot;Formquot;).Range(quot;a1,b9,c12,d13quot;)
If Application.CountA(myRng) gt; 0 _
And Application.CountA(myRng) lt; myRng.Cells.Count Then
Cancel = True
For Each myCell In myRng.Cells
If IsEmpty(myCell) Then
If myEmptyRng Is Nothing Then
Set myEmptyRng = myCell
Else
Set myEmptyRng = Union(myEmptyRng, myCell)
End If
End If
Next myCell
MsgBox myEmptyRng.Address(0, 0) amp; quot; must have valid data!quot;
End If
End Sub
If all the cells are empty, you can still save (nice for changing the master).
But there are other techniques if you don't want to allow all empty cells.
this code goes behind the ThisWorkbook module.
If you're new to macros, you may want to read David McRitchie's intro at:
www.mvps.org/dmcritchie/excel/getstarted.htm
Dan Raab wrote:
gt;
gt; Is there any way to require data entry into cells such that the
gt; save/save as functions can be disabled until the data is entered?
gt;
gt; Thanks,
gt;
gt; Dan
gt;
gt; --
gt; Dan Raab
gt; ------------------------------------------------------------------------
gt; Dan Raab's Profile: www.excelforum.com/member.php...oamp;userid=29414
gt; View this thread: www.excelforum.com/showthread...hreadid=499474
--
Dave Peterson
- Jun 04 Wed 2008 20:44
Disallow File Save if No Input in Cells?
close
全站熱搜
留言列表
發表留言