Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Code for MsgBox

How would I write code for the following situation. Say I have a workbook
with two sheets. Whenever any data hits cell A10 in Sheet2, I would like a
MsgBox to pop up in Sheet1 saying Stop!

Thanks for any suggestions.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Code for MsgBox

Let's assume that hits means any data is entered into.
In Sheet2's worksheet code enter:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Cells(10, "A")) Is Nothing Then
Else
Worksheets("Sheet1").Activate
MsgBox ("STOP")
End If
End Sub
--
Gary''s Student

"TimN" wrote:

How would I write code for the following situation. Say I have a workbook
with two sheets. Whenever any data hits cell A10 in Sheet2, I would like a
MsgBox to pop up in Sheet1 saying Stop!

Thanks for any suggestions.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Code for MsgBox

That did it thanks!

One last thing, I would like the spreadsheet to close when the user clicks
OK in the nessage box without saving and without getting the "Would you like
to save changes?" message. Can I do that?


"Gary''s Student" wrote:

Let's assume that hits means any data is entered into.
In Sheet2's worksheet code enter:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Cells(10, "A")) Is Nothing Then
Else
Worksheets("Sheet1").Activate
MsgBox ("STOP")
End If
End Sub
--
Gary''s Student

"TimN" wrote:

How would I write code for the following situation. Say I have a workbook
with two sheets. Whenever any data hits cell A10 in Sheet2, I would like a
MsgBox to pop up in Sheet1 saying Stop!

Thanks for any suggestions.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Code for MsgBox

You are very welcome. To quit without the additional question:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Cells(10, "A")) Is Nothing Then
Else
Worksheets("Sheet1").Activate
MsgBox ("STOP")
Application.DisplayAlerts = False
Application.Quit
End If
End Sub


--
Gary''s Student


"TimN" wrote:

That did it thanks!

One last thing, I would like the spreadsheet to close when the user clicks
OK in the nessage box without saving and without getting the "Would you like
to save changes?" message. Can I do that?


"Gary''s Student" wrote:

Let's assume that hits means any data is entered into.
In Sheet2's worksheet code enter:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Cells(10, "A")) Is Nothing Then
Else
Worksheets("Sheet1").Activate
MsgBox ("STOP")
End If
End Sub
--
Gary''s Student

"TimN" wrote:

How would I write code for the following situation. Say I have a workbook
with two sheets. Whenever any data hits cell A10 in Sheet2, I would like a
MsgBox to pop up in Sheet1 saying Stop!

Thanks for any suggestions.

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
Msgbox Code Help Please.... kmwhitt Excel Discussion (Misc queries) 5 September 21st 06 01:52 AM
VBA code using if then and msgbox snoopy Excel Discussion (Misc queries) 0 December 1st 05 08:48 PM
Problem with Msgbox Code Old Dog Excel Programming 3 November 23rd 05 01:14 AM
syntax for code in MsgBox()? Ouka[_4_] Excel Programming 2 July 20th 05 05:18 PM
MsgBox Code Error MBlake Excel Programming 8 May 2nd 05 11:16 PM


All times are GMT +1. The time now is 04:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"