Solved

Check a specific cell for a value using If

Posted on 2015-01-14
6
42 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Dealing with unintended Excel Active-X resizing quirks (VBA code simulates "self correction") David Miller (dlmille) Intro Not everyone is a fan of Active-X controls in spreadsheets (as opposed to the UserForm approach, the older Form controls …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

895 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now