Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need a macro that would hide the rows of cells that return #N/A values

Status
Not open for further replies.

bonjourlena

Technical User
Mar 3, 2008
2
US
I have 20 workbooks that all have the same table in the range of cells C63:p133. The table has formulas in every cell and when the value of the formula returns an error, the cells have #N/A value. I need a macro that would analyze the rows (in case of #N/As, the whole row will have them) and hide those that return the #N/A value.
 




Hi

Turn on your macro recorder.

Activate the AutoFilter IN the table

Filter using NOT N/A as a criteria.

Observe your code and modify to suite.

Post back with any questions.

Skip,

[glasses]I'll be dressed to the nines this week, as I go to have my prostatectomy...
Because, if I'm gonna BE impotent, I want to LOOK impotent![tongue]
 
Thank you!
It works on one workbook. But I have about 20 that I want to apply the macro to.
Seems like I cannot apply te auto filter to several workbooks at a time. Ideas?
 
Are all the workbooks in a single folder? If so, you can loop through them using something like:
Code:
Dim fs
Set fs = Application.FileSearch

With fs
    .LookIn = MyPath
    .Filename = "*.xls"
    .Execute
        For i = 1 To .FoundFiles.Count
            Workbooks.Open .FoundFiles(i)
                'Your Code Here
        Next i
End With

Set fs = Nothing

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top