Solved

Check a specific cell for a value using If

Posted on 2015-01-14
6
46 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
[X]
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
  • 3
  • 2
6 Comments
 
LVL 47

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 47

Accepted Solution

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

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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

734 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