ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prevent Saving command if data is not validad (https://www.excelbanter.com/excel-programming/394807-prevent-saving-command-if-data-not-validad.html)

HugoLTote

Prevent Saving command if data is not validad
 
Im trying to force the users to enter the correct format of the data needed,
ive found a way to prevent the save command, but i have not been able to
validate first. Id apreciate some help on this subject.

JLGWhiz

Prevent Saving command if data is not validad
 
It will take a little more information that you have provided to make any
useful suggestions.

"HugoLTote" wrote:

Im trying to force the users to enter the correct format of the data needed,
ive found a way to prevent the save command, but i have not been able to
validate first. Id apreciate some help on this subject.


Ron de Bruin

Prevent Saving command if data is not validad
 
There is a event named BeforeSave in the Thisworkbook module that you can use

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Trim(Sheets("sheet1").Range("A1").Value) = "" Then Cancel = True
End Sub

This example check if there is somethin in cell A1 of "Sheet1"

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"HugoLTote" wrote in message ...
Im trying to force the users to enter the correct format of the data needed,
ive found a way to prevent the save command, but i have not been able to
validate first. Id apreciate some help on this subject.



All times are GMT +1. The time now is 01:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com