I'm not sure how to do this...

Lidsavr

Active Member
Joined
Jan 10, 2008
Messages
330
I am running Excel 2010 and writing code for Excel 2007 and 2003 users.

I want to find if a value exists in Column D. The value is: **FAIL** (including the astericks).

If it does exist, I want a "WARNING" message box to appear. If not, I want to continue with the rest of the macro.

I tried using the Selection.Find method, but I do not know how to proceed if the value is found.

Can someone help me with this?

Thank you,

Charles (Lidsavr)
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Code:
iLoop = worksheetfunction.countif(columns("D"), "**FAIL**")

set ckR = Range("A1")

for i = 1 to iLoop
    Set ckR = Sheet1.Columns("D").Find(What:="**FAIL**", After:=Range("A1"), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True)
range("D" & ckR.row).select
msgbox "WARNING", vbcritical, "**FAIL**"
next i

this should work. It will select the cell and send a warning msg for each **FAIL** in column D

-Brad
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,122
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top