excel vba - Find and Replace using IF condition -


I am currently using the macro below to change the values ​​in my large data but the problem is that the replacement or The replacement values ​​are changing from each data set and if the required value macro error is not found, someone can help me, how do I if condition Cells.replace For example, if if is found D then this block of code Programmed play or skip to the next value.

  Sub-replacement all () applications. Screen Update = False Selection Range ("A1"). Choose Range ("A1"). Select the cell. What is: = "D", Replacement: = "", LookAt: = xlPart, SearchOrder: = _xlByRows, Match CAS: = False, SearchFormat: = False, ReplaceFormat: = False Cells.replace What: = "F" Replacement: = "", LookAt: = xlPart, SearchOrder: = _xlByRows, MatchCase: = False, SearchFormat: = False, ReplaceFormat: = False application ScreenUpdating = True End Sub  
< P>

I do not know why errors should occur, but you can skip all the errors

  sub-replace all () Application Screen Updating = Wrong "Error" sheet ("data") when the error starts again. Select with range ("A1"). "Replacement: =" ", LookAt: = xlPart, SearchOrder: = _xlByRows, MatchCase: = False, SearchFormat: = False, ReplaceFormat: = False. OK: Change what: =" F ", Replacement: =" ErrorAt: = xlPart, SearchOrder: = _xlByRows, MatchCase: = False, SearchFormat: = False, ReplaceFormat: Incorrect Error 0 error on Goto 'errors will be handled again.Application will be handled again.ScreenAppling = True End Sub  

But a better solution would be to handle your errors. For more information about
see

Also, avoid using the select Should try it, because it slows down your macro a terrible lot.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -