Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Halt A Macro If a Cell Contains a Certain Value

I'm looking for a macro to be halted if the value in a cells is less than a
certain figure, with a dialog box informing the user appearing

Cell with value is C1 and anything less than 10, should halt the existing
Macro I have, with a Dialog box appearing showing "Halt Who goes there"

Thanks



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Halt A Macro If a Cell Contains a Certain Value

with Worksheets("Sheet3")
if isnumeric(.Range("C1")) then
if .Range("C1").Value < 10 then
msgbox "Halt Who goes there; number less than 10"
Exit sub
end if
Else
msgbox "Halt Who goes there; no number in C1"
exit sub
End if
End With

' continue to process

--
Regards,
Tom Ogilvy

"John" wrote in message
...
I'm looking for a macro to be halted if the value in a cells is less than

a
certain figure, with a dialog box informing the user appearing

Cell with value is C1 and anything less than 10, should halt the existing
Macro I have, with a Dialog box appearing showing "Halt Who goes there"

Thanks





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Halt A Macro If a Cell Contains a Certain Value

Thanks for the code Tom


"Tom Ogilvy" wrote in message
...
with Worksheets("Sheet3")
if isnumeric(.Range("C1")) then
if .Range("C1").Value < 10 then
msgbox "Halt Who goes there; number less than 10"
Exit sub
end if
Else
msgbox "Halt Who goes there; no number in C1"
exit sub
End if
End With

' continue to process

--
Regards,
Tom Ogilvy

"John" wrote in message
...
I'm looking for a macro to be halted if the value in a cells is less than

a
certain figure, with a dialog box informing the user appearing

Cell with value is C1 and anything less than 10, should halt the existing
Macro I have, with a Dialog box appearing showing "Halt Who goes there"

Thanks







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Halt A Macro If a Cell Contains a Certain Value

Tom

I wish to remove the message "msgbox "Halt Who goes there; no number in C1",
just want the one dialog box, but I can't work out my If's from my with's


"John" wrote in message
...
Thanks for the code Tom


"Tom Ogilvy" wrote in message
...
with Worksheets("Sheet3")
if isnumeric(.Range("C1")) then
if .Range("C1").Value < 10 then
msgbox "Halt Who goes there; number less than 10"
Exit sub
end if
Else
msgbox "Halt Who goes there; no number in C1"
exit sub
End if
End With

' continue to process

--
Regards,
Tom Ogilvy

"John" wrote in message
...
I'm looking for a macro to be halted if the value in a cells is less
than

a
certain figure, with a dialog box informing the user appearing

Cell with value is C1 and anything less than 10, should halt the
existing
Macro I have, with a Dialog box appearing showing "Halt Who goes there"

Thanks









  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Halt A Macro If a Cell Contains a Certain Value

If C1 will always contain a number

with Worksheets("Sheet3")

if .Range("C1").Value < 10 then
msgbox "Halt Who goes there"
Exit sub
end if
End With


--
Regards,
Tom Ogilvy


rg
"John" wrote in message
...
Tom

I wish to remove the message "msgbox "Halt Who goes there; no number in

C1",
just want the one dialog box, but I can't work out my If's from my with's


"John" wrote in message
...
Thanks for the code Tom


"Tom Ogilvy" wrote in message
...
with Worksheets("Sheet3")
if isnumeric(.Range("C1")) then
if .Range("C1").Value < 10 then
msgbox "Halt Who goes there; number less than 10"
Exit sub
end if
Else
msgbox "Halt Who goes there; no number in C1"
exit sub
End if
End With

' continue to process

--
Regards,
Tom Ogilvy

"John" wrote in message
...
I'm looking for a macro to be halted if the value in a cells is less
than
a
certain figure, with a dialog box informing the user appearing

Cell with value is C1 and anything less than 10, should halt the
existing
Macro I have, with a Dialog box appearing showing "Halt Who goes

there"

Thanks













  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Halt A Macro If a Cell Contains a Certain Value

Thanks Tom, I get totally confused with the number of if, end if, with etc,
no matter what I take-out / remove it always seems to hit debug



"Tom Ogilvy" wrote in message
...
If C1 will always contain a number

with Worksheets("Sheet3")

if .Range("C1").Value < 10 then
msgbox "Halt Who goes there"
Exit sub
end if
End With


--
Regards,
Tom Ogilvy


rg
"John" wrote in message
...
Tom

I wish to remove the message "msgbox "Halt Who goes there; no number in

C1",
just want the one dialog box, but I can't work out my If's from my with's


"John" wrote in message
...
Thanks for the code Tom


"Tom Ogilvy" wrote in message
...
with Worksheets("Sheet3")
if isnumeric(.Range("C1")) then
if .Range("C1").Value < 10 then
msgbox "Halt Who goes there; number less than 10"
Exit sub
end if
Else
msgbox "Halt Who goes there; no number in C1"
exit sub
End if
End With

' continue to process

--
Regards,
Tom Ogilvy

"John" wrote in message
...
I'm looking for a macro to be halted if the value in a cells is less
than
a
certain figure, with a dialog box informing the user appearing

Cell with value is C1 and anything less than 10, should halt the
existing
Macro I have, with a Dialog box appearing showing "Halt Who goes

there"

Thanks













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
Halt Rest of Macro after Error €“ Jim Cone review Jenny B. Excel Discussion (Misc queries) 2 January 12th 08 03:11 AM
"No RETURN() or HALT() function found on macro sheet." Will Excel Worksheet Functions 2 January 4th 07 10:10 PM
No RETURN() or HALT() function found on macro sheet [email protected] Excel Discussion (Misc queries) 3 September 26th 06 03:35 PM
Halt all code while macro runs TimT Excel Programming 1 October 12th 05 04:51 PM
Code to halt a macro floss Excel Programming 1 April 26th 04 08:22 PM


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