VBA Find Function (easyish)

Joined
Nov 10, 2011
Messages
5
Reaction score
0
I have the following code written in vba


VBA
Range("C2:U2").Select
Selection.Find(What:="12x", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
/VBA

it works, but when there is no 12x in this range, i need it to forget about the statement and run the next bit of code, instead of bringing up a runtime error 91.

Can somebody please suggest some VBA code, as I do not have a clue...... Cheers, much appreciated
 
Joined
Nov 10, 2011
Messages
5
Reaction score
0
I now have this formula;

Range("C" & i, "U" & i).Select
Selection.Replace What:="12x", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Copy
Range("V" & i).PasteSpecial

the above,is meant to only copy the ones where the replacement has taken place, but instead, it copies the whole range over, how do i counteract this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top