End process If Formula contains #N/A in Column

Guna13

Board Regular
Joined
Nov 22, 2019
Messages
70
Office Version
  1. 365
Platform
  1. Windows
Hi All,

How can I end process If Column From "M:AA" Formula contains any #N/A. also, Please before exit, it will show Exact Row Number & Column Number in MsgBox. Like 8 rows & Z column Like that.

kindly help me.
Rich (BB code):
Sub Validate()

Targ.Select

    If WorksheetFunction.CountIf(Columns("M:AA"), "#N/A") Then
        MsgBox "Error found" ( How can i get it here Exact Row and Column for User Easy Identification ) 
        Exit Sub
    End If
    MsgBox "No errors found"
 
Last edited by a moderator:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
One way.
VBA Code:
    Dim rngFound As Range
    Set rngFound = Range("M:AA").Find(What:="#N/A", LookAt:=xlWhole, LookIn:=xlValues)
    If Not rngFound Is Nothing Then
        MsgBox "#N/A Error found in cell " & rngFound.Address(0, 0)
        Exit Sub
    Else
        MsgBox "No Errors Found"
        Exit Sub
    End If
 
Upvote 0
Solution
@Guna13
If you want to highlight specific text in your vba, you need to to use the RICH code tags.

1668940515793.png


I have changed the tags for you above.
 
Upvote 0
@Guna13
'Mark as solution' should be used only for that. I have removed it from post #3 as that post clearly does not contain a solution to the thread question.
 
Upvote 0

Forum statistics

Threads
1,215,762
Messages
6,126,736
Members
449,334
Latest member
moses007

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