Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Search that Exits Sub or Ends If
Sheet1 D8 will be the value that I am searching for.
Sheet2 Column B is the location of all cell values that I want to search. Trying to imbed this function in a macro to do the following. (Granted I may have to use something other than just an If function but that's why I'm posting) =) If value in Sheet1 D8 = any of the cell values in Sheet2 Column B Then MsgBox "Try again." Exit Sub Else End If I just can't seem to find the proper setup that I am looking for. Any help would be greatly appreciated! Thank you! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
If Search that Exits Sub or Ends If
Here you go. Not too sure why you need the Exit Sub since you have the if
statement to control the flow of exectuins but to each his own... If Application.WorksheetFunction.CountIf(Sheets("Shee t2").Columns("B"), _ Sheets("Sheet1").Range("D8").Value) = 1 Then MsgBox "Try Again" Else End If -- HTH... Jim Thomlinson "Ryan Hess" wrote: Sheet1 D8 will be the value that I am searching for. Sheet2 Column B is the location of all cell values that I want to search. Trying to imbed this function in a macro to do the following. (Granted I may have to use something other than just an If function but that's why I'm posting) =) If value in Sheet1 D8 = any of the cell values in Sheet2 Column B Then MsgBox "Try again." Exit Sub Else End If I just can't seem to find the proper setup that I am looking for. Any help would be greatly appreciated! Thank you! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find if value exits in array | Excel Worksheet Functions | |||
filter using "ends with" and 3 choices? Ex: ends with 1,2 or3 | Excel Worksheet Functions | |||
Sub Exits Unexpectedly | Excel Programming | |||
way to run sub after user exits textbox | Excel Programming | |||
graceful exits | Excel Programming |