#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Data Validation

Hey folks,

Need help again...
C, i have a workbook wich destination is to work as a research one between
my clients.

I've made the whole thing and 've inserted a button with a macro that save
the file, right in the end of the sheet that wors as kind of a form.

My problem is that i want that macro, before it saves the file, do a kind of
validation of the data inserted in six different cells, denying the save
command and poping a validation error if the data is invalid.

Could u help, plz?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 320
Default Data Validation

The macro could do something like this:
Sub MaybeSave()
If Range("F3").value<17 or _
Range("G12").value < "Bob" or _
Range("G15").value < "Ken" or _
Range("F1").value < 33 or _
Range("A8").value < 44 or _
Range("B33").value < "Joe" then
Msgbox "Please Fill in the appropriate fields before this can
succeed.",vbexclamation
Exit Sub
End If
'Continue with whatever you had here.....
End Sub

"mantros" wrote:

Hey folks,

Need help again...
C, i have a workbook wich destination is to work as a research one between
my clients.

I've made the whole thing and 've inserted a button with a macro that save
the file, right in the end of the sheet that wors as kind of a form.

My problem is that i want that macro, before it saves the file, do a kind of
validation of the data inserted in six different cells, denying the save
command and poping a validation error if the data is invalid.

Could u help, plz?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Data Validation

i'll try it now...

"Bob Umlas, Excel MVP" wrote:

The macro could do something like this:
Sub MaybeSave()
If Range("F3").value<17 or _
Range("G12").value < "Bob" or _
Range("G15").value < "Ken" or _
Range("F1").value < 33 or _
Range("A8").value < 44 or _
Range("B33").value < "Joe" then
Msgbox "Please Fill in the appropriate fields before this can
succeed.",vbexclamation
Exit Sub
End If
'Continue with whatever you had here.....
End Sub

"mantros" wrote:

Hey folks,

Need help again...
C, i have a workbook wich destination is to work as a research one between
my clients.

I've made the whole thing and 've inserted a button with a macro that save
the file, right in the end of the sheet that wors as kind of a form.

My problem is that i want that macro, before it saves the file, do a kind of
validation of the data inserted in six different cells, denying the save
command and poping a validation error if the data is invalid.

Could u help, plz?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Data Validation

Hey man, that worked! Thx for the advice... still a newbie with VBA...

Cya

"Bob Umlas, Excel MVP" escreveu:

The macro could do something like this:
Sub MaybeSave()
If Range("F3").value<17 or _
Range("G12").value < "Bob" or _
Range("G15").value < "Ken" or _
Range("F1").value < 33 or _
Range("A8").value < 44 or _
Range("B33").value < "Joe" then
Msgbox "Please Fill in the appropriate fields before this can
succeed.",vbexclamation
Exit Sub
End If
'Continue with whatever you had here.....
End Sub

"mantros" wrote:

Hey folks,

Need help again...
C, i have a workbook wich destination is to work as a research one between
my clients.

I've made the whole thing and 've inserted a button with a macro that save
the file, right in the end of the sheet that wors as kind of a form.

My problem is that i want that macro, before it saves the file, do a kind of
validation of the data inserted in six different cells, denying the save
command and poping a validation error if the data is invalid.

Could u help, plz?

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
Data validation dakotasteve Excel Worksheet Functions 13 August 5th 06 01:28 AM
Macro question Chris Excel Worksheet Functions 12 July 7th 06 01:23 AM
Inputting data to one worksheet for it effect another daedalus1 Excel Discussion (Misc queries) 1 June 25th 06 04:39 PM
named range, data validation: list non-selected items, and new added items KR Excel Discussion (Misc queries) 1 June 24th 05 05:21 AM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM


All times are GMT +1. The time now is 03:14 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"