Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Check a specific cell for a value using If

Posted on 2015-01-14
6
44 Views
Last Modified: 2015-02-07
How do I check AD2 for this value?  I cannot first use a select AD2, need it in an IF
I need to Exit a sub if this is true...  if not continue on.

If AD2 = "Dup Already Converted" Then 'This is the first cell cannot be = "Dup Already Converted"
MsgBox ("Yupper it is equal to Dup Already Converted")

Else
MsgBox ("Nope it is not equal to Dup Already Converted")

End If
0
Comment
Question by:RWayneH
  • 3
  • 2
6 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40549814
Either this (not sure which you want)

If AD2 = "Dup Already Converted" Then 'This is the first cell cannot be = "Dup Already Converted"
MsgBox ("Yupper it is equal to Dup Already Converted")
Exit Sub
Else
MsgBox ("Nope it is not equal to Dup Already Converted")

End If

Open in new window


or this

If AD2 = "Dup Already Converted" Then 'This is the first cell cannot be = "Dup Already Converted"
MsgBox ("Yupper it is equal to Dup Already Converted")

Else
MsgBox ("Nope it is not equal to Dup Already Converted")
Exit Sub
End If

Open in new window

0
 

Author Comment

by:RWayneH
ID: 40549821
The issue is that it is equal to that and the If is not catching it....  It skips over and straight to End If ?? and I am not sure why?  Thought it is in the way I am writing it.
0
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40549834
Change AD2 to Range("AD2")
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40595986
I've requested that this question be closed as follows:

Accepted answer: 500 points for Martin Liss's comment #a40549834

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 

Author Closing Comment

by:RWayneH
ID: 40595987
Thanks for the help
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question