Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a macro that i would like to NOT to run (or stop) if it does
not contain the word "wildman" in a range A2:A30000 or if there is no text in that range as well. Thanks in advance Wildman |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Private Sub CommandButton1_Click() If WorksheetFunction.CountIf(Range("A2:A30"), "wildman") < 1 Then Exit Sub End If ' continue your code here End Sub No need to check if range empty as if "wildman" not there then no need to run macro. I have a macro that i would like to NOT to run (or stop) if it does not contain the word "wildman" in a range A2:A30000 or if there is no text in that range as well. Mangesh -- mangesh_yadav ------------------------------------------------------------------------ mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470 View this thread: http://www.excelforum.com/showthread...hreadid=375134 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
OK, am I the only one wondering why the heck you're looking for a
wildman? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No you are not the only one.
"Nick Hebb" wrote in message ups.com... OK, am I the only one wondering why the heck you're looking for a wildman? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() nv test it out but shld be correct Code: -------------------- sub macro() For each rngCell in activesheet.range(A2:A30000).cells if rngCell.value="wildman" then blnWildman=true blnNotEmpty=true exit for elseif rngCell<empty then blnNotEmpty=true exit for end if next rngCell if blnWildman<true and blnNotEmpty<true then Exit sub end if <macro code End Sub -------------------- -- d61helix ------------------------------------------------------------------------ d61helix's Profile: http://www.excelforum.com/member.php...o&userid=20090 View this thread: http://www.excelforum.com/showthread...hreadid=375134 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
stop a macro from being used | Excel Discussion (Misc queries) | |||
Macro Stop | Excel Worksheet Functions | |||
Macro: With Stop it works. Without Stop it doesn't. | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming | |||
How do I stop a macro | Excel Programming |