Solved

Check a specific cell for a value using If

Posted on 2015-01-14
6
45 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 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

685 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