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

I don't know if this is possible in Excel, but here is what I want to do.

I want to create a "check" for the users. Basically 2 cells need to equal
eachother before they can sumbit the worksheet. What I would like to happen
is if the 2 cells don't equal a dialog block pops up saaying "Reimbursable
data does not equal!!".

Is this possible?

Thanks in advance!
Stacy
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Dialog Boxes

hi
assuming your cells to equal are b1 and c1(change if needed), try this...
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Range("B1").Value < Range("C1").Value Then
MsgBox ("Reimbursable data does not equal!!")
Cancel = True
End If

End Sub

this is before save event which means they can't save the file untill the 2
cells are equal.
if that is undesirable then you might want to concider the before close
event where they wont be able to close the file until the 2 cells are equal.

Regards
FSt1

"stacy05" wrote:

I don't know if this is possible in Excel, but here is what I want to do.

I want to create a "check" for the users. Basically 2 cells need to equal
eachother before they can sumbit the worksheet. What I would like to happen
is if the 2 cells don't equal a dialog block pops up saaying "Reimbursable
data does not equal!!".

Is this possible?

Thanks in advance!
Stacy

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Dialog Boxes

hi again,
perhaps i should have mentions that this is this workbook event code and
goes in a thisworkbook module and not a standard module.

regards
FSt1

"FSt1" wrote:

hi
assuming your cells to equal are b1 and c1(change if needed), try this...
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Range("B1").Value < Range("C1").Value Then
MsgBox ("Reimbursable data does not equal!!")
Cancel = True
End If

End Sub

this is before save event which means they can't save the file untill the 2
cells are equal.
if that is undesirable then you might want to concider the before close
event where they wont be able to close the file until the 2 cells are equal.

Regards
FSt1

"stacy05" wrote:

I don't know if this is possible in Excel, but here is what I want to do.

I want to create a "check" for the users. Basically 2 cells need to equal
eachother before they can sumbit the worksheet. What I would like to happen
is if the 2 cells don't equal a dialog block pops up saaying "Reimbursable
data does not equal!!".

Is this possible?

Thanks in advance!
Stacy

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

Okay, where do I go to input this equation?

"FSt1" wrote:

hi again,
perhaps i should have mentions that this is this workbook event code and
goes in a thisworkbook module and not a standard module.

regards
FSt1

"FSt1" wrote:

hi
assuming your cells to equal are b1 and c1(change if needed), try this...
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Range("B1").Value < Range("C1").Value Then
MsgBox ("Reimbursable data does not equal!!")
Cancel = True
End If

End Sub

this is before save event which means they can't save the file untill the 2
cells are equal.
if that is undesirable then you might want to concider the before close
event where they wont be able to close the file until the 2 cells are equal.

Regards
FSt1

"stacy05" wrote:

I don't know if this is possible in Excel, but here is what I want to do.

I want to create a "check" for the users. Basically 2 cells need to equal
eachother before they can sumbit the worksheet. What I would like to happen
is if the 2 cells don't equal a dialog block pops up saaying "Reimbursable
data does not equal!!".

Is this possible?

Thanks in advance!
Stacy

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Dialog Boxes

hi
open the vb editor(alt+F11)
in the project windowfar left) of the vb editor, expand your project(file)
and click on this workbook.
in the left dropdown above the code window(big window,far right), select
this workbook.
sub workbook_open will default. delete it
in the right dropdown above the code window, select wither before save or
before close(which ever you decided)
paste this between sub and end sub..

If Range("B1").Value < Range("C1").Value Then
MsgBox ("Reimbursable data does not equal!!")
Cancel = True
End If

close the vb editor and save the file
done

regards
FSt1

"stacy05" wrote:

Okay, where do I go to input this equation?

"FSt1" wrote:

hi again,
perhaps i should have mentions that this is this workbook event code and
goes in a thisworkbook module and not a standard module.

regards
FSt1

"FSt1" wrote:

hi
assuming your cells to equal are b1 and c1(change if needed), try this...
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Range("B1").Value < Range("C1").Value Then
MsgBox ("Reimbursable data does not equal!!")
Cancel = True
End If

End Sub

this is before save event which means they can't save the file untill the 2
cells are equal.
if that is undesirable then you might want to concider the before close
event where they wont be able to close the file until the 2 cells are equal.

Regards
FSt1

"stacy05" wrote:

I don't know if this is possible in Excel, but here is what I want to do.

I want to create a "check" for the users. Basically 2 cells need to equal
eachother before they can sumbit the worksheet. What I would like to happen
is if the 2 cells don't equal a dialog block pops up saaying "Reimbursable
data does not equal!!".

Is this possible?

Thanks in advance!
Stacy



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Dialog Boxes

Right-click on the Excel Icon left of "File" on the menubar.

Select "View Code" and paste the code into that module.

I would make one change to isolate to one specific worksheet.

If Sheets("Sheet1").Range("B1").Value < Range("C1").Value Then

Alt + q to return to the Excel window.

Save your workbook.

Re-open, edit B1 to not equal C1 and try to save the workbook.

Message will pop up and Save will be cancelled.

NOTE: if B1 and C1 are both blank the workbook will save.

Does that count as "being the same"?


Gord Dibben MS Excel MVP

On Mon, 4 Feb 2008 11:29:01 -0800, stacy05
wrote:

Okay, where do I go to input this equation?

"FSt1" wrote:

hi again,
perhaps i should have mentions that this is this workbook event code and
goes in a thisworkbook module and not a standard module.

regards
FSt1

"FSt1" wrote:

hi
assuming your cells to equal are b1 and c1(change if needed), try this...
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Range("B1").Value < Range("C1").Value Then
MsgBox ("Reimbursable data does not equal!!")
Cancel = True
End If

End Sub

this is before save event which means they can't save the file untill the 2
cells are equal.
if that is undesirable then you might want to concider the before close
event where they wont be able to close the file until the 2 cells are equal.

Regards
FSt1

"stacy05" wrote:

I don't know if this is possible in Excel, but here is what I want to do.

I want to create a "check" for the users. Basically 2 cells need to equal
eachother before they can sumbit the worksheet. What I would like to happen
is if the 2 cells don't equal a dialog block pops up saaying "Reimbursable
data does not equal!!".

Is this possible?

Thanks in advance!
Stacy


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Dialog Boxes

thanks!!!

I did it before close, but now it wont let me close the spreadsheet.
Is there a way for me to force clase?

"FSt1" wrote:

hi
open the vb editor(alt+F11)
in the project windowfar left) of the vb editor, expand your project(file)
and click on this workbook.
in the left dropdown above the code window(big window,far right), select
this workbook.
sub workbook_open will default. delete it
in the right dropdown above the code window, select wither before save or
before close(which ever you decided)
paste this between sub and end sub..

If Range("B1").Value < Range("C1").Value Then
MsgBox ("Reimbursable data does not equal!!")
Cancel = True
End If

close the vb editor and save the file
done

regards
FSt1

"stacy05" wrote:

Okay, where do I go to input this equation?

"FSt1" wrote:

hi again,
perhaps i should have mentions that this is this workbook event code and
goes in a thisworkbook module and not a standard module.

regards
FSt1

"FSt1" wrote:

hi
assuming your cells to equal are b1 and c1(change if needed), try this...
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Range("B1").Value < Range("C1").Value Then
MsgBox ("Reimbursable data does not equal!!")
Cancel = True
End If

End Sub

this is before save event which means they can't save the file untill the 2
cells are equal.
if that is undesirable then you might want to concider the before close
event where they wont be able to close the file until the 2 cells are equal.

Regards
FSt1

"stacy05" wrote:

I don't know if this is possible in Excel, but here is what I want to do.

I want to create a "check" for the users. Basically 2 cells need to equal
eachother before they can sumbit the worksheet. What I would like to happen
is if the 2 cells don't equal a dialog block pops up saaying "Reimbursable
data does not equal!!".

Is this possible?

Thanks in advance!
Stacy

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Dialog Boxes

hi
yes. make the two cells equal

regards
FSt1

"stacy05" wrote:

thanks!!!

I did it before close, but now it wont let me close the spreadsheet.
Is there a way for me to force clase?

"FSt1" wrote:

hi
open the vb editor(alt+F11)
in the project windowfar left) of the vb editor, expand your project(file)
and click on this workbook.
in the left dropdown above the code window(big window,far right), select
this workbook.
sub workbook_open will default. delete it
in the right dropdown above the code window, select wither before save or
before close(which ever you decided)
paste this between sub and end sub..

If Range("B1").Value < Range("C1").Value Then
MsgBox ("Reimbursable data does not equal!!")
Cancel = True
End If

close the vb editor and save the file
done

regards
FSt1

"stacy05" wrote:

Okay, where do I go to input this equation?

"FSt1" wrote:

hi again,
perhaps i should have mentions that this is this workbook event code and
goes in a thisworkbook module and not a standard module.

regards
FSt1

"FSt1" wrote:

hi
assuming your cells to equal are b1 and c1(change if needed), try this...
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Range("B1").Value < Range("C1").Value Then
MsgBox ("Reimbursable data does not equal!!")
Cancel = True
End If

End Sub

this is before save event which means they can't save the file untill the 2
cells are equal.
if that is undesirable then you might want to concider the before close
event where they wont be able to close the file until the 2 cells are equal.

Regards
FSt1

"stacy05" wrote:

I don't know if this is possible in Excel, but here is what I want to do.

I want to create a "check" for the users. Basically 2 cells need to equal
eachother before they can sumbit the worksheet. What I would like to happen
is if the 2 cells don't equal a dialog block pops up saaying "Reimbursable
data does not equal!!".

Is this possible?

Thanks in advance!
Stacy

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,290
Default Dialog Boxes


Another way...
Use a custom number format in the cell with the formula.
The formula might look like... =A5-B5

The cell number format could look like...
[Red][<0]"Reimbursable data does not equal!";[Blue][=0]0;@
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"stacy05"
wrote in message
I don't know if this is possible in Excel, but here is what I want to do.
I want to create a "check" for the users. Basically 2 cells need to equal
eachother before they can sumbit the worksheet. What I would like to happen
is if the 2 cells don't equal a dialog block pops up saaying "Reimbursable
data does not equal!!".
Is this possible?

Thanks in advance!
Stacy
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
dialog boxes Dave F Excel Discussion (Misc queries) 5 August 24th 06 10:03 PM
Using Dialog Boxes Goldstar0011 Excel Worksheet Functions 0 November 29th 05 10:46 PM
Dialog Boxes naiveprogrammer Excel Discussion (Misc queries) 2 October 18th 05 10:30 PM
Dialog boxes webster Excel Discussion (Misc queries) 5 July 9th 05 11:16 AM
How can I change the size of dialog boxes? Dale Hildebrand Excel Discussion (Misc queries) 2 December 2nd 04 05:12 PM


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