MATCH and clear cells

Inactiver183192

New Member
Joined
Jun 12, 2011
Messages
15
HI

I am trying to do a simple match but get an error
Dim NAerror as variant


NAerror = Application.Match("#N/A", RawData.Range("A1:J1589"), 0)

I don't quite understand what is wrong the error comes up as error 2042 which is no match but the data is definitely there. I want to be able to find all cells and delete/clear them.THanks!
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi,

Maybe try this alternative:

Code:
Sub Try()

Dim c As Range

For Each c In Range("A1:J1589")
    If IsError(c) Then ' Or Application.WorksheetFunction.IsNA(c)
        c.Clear 'or c.delete
    End If
Next c

End Sub
 
Upvote 0
Or try something like this...
Code:
RawData.Range("A1:J1589").SpecialCells(xlCellTypeFormulas, xlErrors).ClearContents
 
Upvote 0
Hiya thanks for that. I will use it but I wanted to do a match just to make in quicker so that I don't have to look in each cell one by one rather just go straight to the matched cell.If anyone else has any help on the match function that would be great. I can't seem to get it to work on any level and I think it must be they way I define my variables or something. Cheers
 
Upvote 0
I think I may have found the problem in match does the array just need to be 1 row or 1column array? I like your code alpha frog thanks alot for that!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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