Cant Find value in formuale- VBA

gogeta1998

New Member
Joined
Mar 21, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I'm writing a macro to make it such that if a value is found in column B then do one thing, otherwise do another thing. However it doesn't return the correct value because it doesnt look at the the text the formulae outputs.

VBA Code:
Sub Value_Find()

Dim Cell As Range
Columns("B:B").Select
Set Cell = Selection.Find(What:="Please Add Institution", After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False)

If Cell Is Nothing Then
    MsgBox "It Works"
Else
    MsgBox "Please Add Institution"
End If



End Sub

so, if I write "Please Add Institution" manually then it returns the correct message box, however if there is a formulae making the cell value "Please Add Institution", then it doesn't print the correct message- instead it prints "It Works".

Please help thanks
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,787
Messages
6,180,950
Members
453,008
Latest member
GRTMAN

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