Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
tjb
 
Posts: n/a
Default Help with MsgBox...

When the user selects the number 350 from a list validated cell or enters 350
into a list validated cell I want to use MsgBox or a UserForm to display a
message. On the MsgBox or UserForm I want two options, OK and another button
that will clear the entry of 350 from the cell, like a Cancel button or
something along those lines. Thanks!
  #2   Report Post  
Harald Staff
 
Posts: n/a
Default

Hi

Macro work. Rightclick the sheet tab, choose View code, paste this in:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target(1).Value = 350 Then
If MsgBox("350 -you mean for real ?", vbYesNo + vbQuestion) = vbNo Then
Target(1).Value = ""
End If
End If
End Sub

HTH. Best wishes Harald

"tjb" skrev i melding
...
When the user selects the number 350 from a list validated cell or enters

350
into a list validated cell I want to use MsgBox or a UserForm to display a
message. On the MsgBox or UserForm I want two options, OK and another

button
that will clear the entry of 350 from the cell, like a Cancel button or
something along those lines. Thanks!



  #3   Report Post  
tjb
 
Posts: n/a
Default

This is good except for I need the warning to occur when 350 is entered in a
specific cell, not any cell on the worksheet. Any suggestions?

"Harald Staff" wrote:

Hi

Macro work. Rightclick the sheet tab, choose View code, paste this in:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target(1).Value = 350 Then
If MsgBox("350 -you mean for real ?", vbYesNo + vbQuestion) = vbNo Then
Target(1).Value = ""
End If
End If
End Sub

HTH. Best wishes Harald

"tjb" skrev i melding
...
When the user selects the number 350 from a list validated cell or enters

350
into a list validated cell I want to use MsgBox or a UserForm to display a
message. On the MsgBox or UserForm I want two options, OK and another

button
that will clear the entry of 350 from the cell, like a Cancel button or
something along those lines. Thanks!




  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

You can modify Harald's suggested code to check for a range first:

Private Sub Worksheet_Change(ByVal Target As Range)

if intersect(target(1),me.range("a1")) is nothing then exit sub

If Target(1).Value = 350 Then
If MsgBox("350 -you mean for real ?", vbYesNo + vbQuestion) = vbNo Then
Target(1).Value = ""
End If
End If
End Sub

Or even check a complete column with something like:

if intersect(target(1),me.range("a:a")) is nothing then exit sub

tjb wrote:

This is good except for I need the warning to occur when 350 is entered in a
specific cell, not any cell on the worksheet. Any suggestions?

"Harald Staff" wrote:

Hi

Macro work. Rightclick the sheet tab, choose View code, paste this in:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target(1).Value = 350 Then
If MsgBox("350 -you mean for real ?", vbYesNo + vbQuestion) = vbNo Then
Target(1).Value = ""
End If
End If
End Sub

HTH. Best wishes Harald

"tjb" skrev i melding
...
When the user selects the number 350 from a list validated cell or enters

350
into a list validated cell I want to use MsgBox or a UserForm to display a
message. On the MsgBox or UserForm I want two options, OK and another

button
that will clear the entry of 350 from the cell, like a Cancel button or
something along those lines. Thanks!





--

Dave Peterson
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
Lost my Paste Mike R Excel Discussion (Misc queries) 11 August 29th 05 12:22 AM
Select non-consecutive rows dee Excel Discussion (Misc queries) 14 December 4th 04 08:45 PM
Problem with array and msgbox aking1987 Excel Worksheet Functions 0 November 1st 04 08:57 AM
Problem with array and msgbox aking1987 Excel Worksheet Functions 1 October 29th 04 01:57 PM
Problem with array and msgbox aking1987 Excel Worksheet Functions 2 October 28th 04 06:20 PM


All times are GMT +1. The time now is 01:12 AM.

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"