Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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
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
Find if value exits in array Glynn Excel Worksheet Functions 6 September 5th 08 08:46 PM
filter using "ends with" and 3 choices? Ex: ends with 1,2 or3 Debbie Excel Worksheet Functions 1 April 6th 07 12:07 AM
Sub Exits Unexpectedly Walker Excel Programming 4 July 25th 05 10:43 PM
way to run sub after user exits textbox funkymonkUK[_50_] Excel Programming 2 July 12th 05 01:10 PM
graceful exits Bryan[_12_] Excel Programming 3 November 23rd 04 07:56 PM


All times are GMT +1. The time now is 02:34 AM.

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"