Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default short message box

Hi, all:

I have a worksheet which requires cell A1 value must be = 0. My macro
will pop up an ERROR message if this value is 0. The user must fix
this value to 0 before other coding was compiled. How to fix this?

here is my code:

Sub Test()

if worksheets("Sheet1").Range("A1").value 0 Then

msgbox"This value must be 0. Please fix before proceeding",vbcritical,
"Must fix the value before proceeding"

End if

Other coding ..........

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,311
Default short message box

Not sure what you want to do...but if you want the code to stop running so
that the cell can be fixed, then maybe this:

Sub Test()

if worksheets("Sheet1").Range("A1").value 0 _
Then
msgbox"This value must be 0. Please fix before
proceeding",vbcritical, "Must fix the value before proceeding"
end
Else
End if

Other coding ..........

End Sub


You might also change the if line of code to be "<0"

HTH,
Paul


"George" wrote in message
oups.com...
Hi, all:

I have a worksheet which requires cell A1 value must be = 0. My macro
will pop up an ERROR message if this value is 0. The user must fix
this value to 0 before other coding was compiled. How to fix this?

here is my code:

Sub Test()

if worksheets("Sheet1").Range("A1").value 0 Then

msgbox"This value must be 0. Please fix before proceeding",vbcritical,
"Must fix the value before proceeding"

End if

Other coding ..........

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default short message box

Something like this:

Sub Test()

if worksheets("Sheet1").Range("A1").value < 0 Then

msgbox "This value must be 0. Please fix before proceeding",vbcritical,
"Must fix the value before proceeding"
Exit Sub
End if

'Other coding ..........

End Sub



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"George" wrote:

Hi, all:

I have a worksheet which requires cell A1 value must be = 0. My macro
will pop up an ERROR message if this value is 0. The user must fix
this value to 0 before other coding was compiled. How to fix this?

here is my code:

Sub Test()

if worksheets("Sheet1").Range("A1").value 0 Then

msgbox"This value must be 0. Please fix before proceeding",vbcritical,
"Must fix the value before proceeding"

End if

Other coding ..........

End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default short message box

i must be missing something, because if you test the value A1 and it is 0, why
don't you just set it to 0?

--


Gary


"George" wrote in message
oups.com...
Hi, all:

I have a worksheet which requires cell A1 value must be = 0. My macro
will pop up an ERROR message if this value is 0. The user must fix
this value to 0 before other coding was compiled. How to fix this?

here is my code:

Sub Test()

if worksheets("Sheet1").Range("A1").value 0 Then

msgbox"This value must be 0. Please fix before proceeding",vbcritical,
"Must fix the value before proceeding"

End if

Other coding ..........

End Sub



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default short message box

Hi, Paul and Wigi:

Both of your ways are perfect! They are exactly what I want. Why
should I set A1 value <0? Thank you so much for your help!


Hi, Gary:

Good question. The reason why I need to set it up as zero is because
that is the condition to pop up the message.

Thanks for your interest!

George





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
SHORT KEY Arbab[_2_] Excel Discussion (Misc queries) 5 January 16th 09 02:25 PM
Intercept/replace standard 'cell protected' message with my own message? KR Excel Programming 3 March 16th 06 02:31 PM
Displaying a message in a message box without requiring user to click anything to proceed Android[_2_] Excel Programming 2 June 25th 04 06:44 PM
short cut fabalicious[_20_] Excel Programming 4 May 5th 04 03:50 PM
short message after button click RuudS[_2_] Excel Programming 4 January 23rd 04 03:00 PM


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