Excel VBA .find issue -


I am a new member of this forum, but have done some research for this particular problem. I have not found anything yet.

I need a VBA script that searches for value in a cell I7 worksbook wb1 , And in another workbook, a sheet named "code" named wb2 refers to the reference of a column A: A if it finds the cell I7 Column A: A , the value will put "value found" in cell I7 . If he is not getting that value in the column range, then he will copy and paste the old values ​​from the old sheet as it is a new one.

The Excel code is executing, but the problem I am experiencing is that if the value is not in the referenced column, then the code does not seem to be taking it, so the code is just " Value added ", regardless of the values ​​found in any referenced column, am I missing something here?

  WB1 as a slow workbook, wb2 as a workbook, dim range set ("A: A") set WBS = Sh1.Column (1). Search (what: = wb2.Sheets ("summary") value ("I7: I7"). Value, LookIn: = xlValues, LookAt: = xlWhole, SearchOrder: = xlByRows, SearchDirection: = xlNext, MatchCase: = False) If the WBS is not something then wb1.Sheets ("summary") range ("I7: I7") copy wb2.Sheets ("summary"). Range ("I7: I7"). Paste Special Paste: = xlPasteAll else wb2.Sheets ("summary"). Range ("I7: I7"). Value = "value found" end if    

As you have announced your comments on Ron And urgently need some amen dments Can you do set wb1 and wb2 in your code?

This simple version works fine:

  sub-simplified () dim rn1 range set as RBS in the form of RBS rn1 = range ("A: A ") Set WBS = rn1.Find (_ key: = range (" I7 "). Value, _ LookIn: = xlValues, _ LookAt: = xlWhole, _SearchOrder: = XLBir, _Search Direction: = XLNEST, _Maccees: = False) If WBS is nothing, range ("I7") copy range ("J7"). Paste Special Paste: = Excel XL Value Else Range ("J7"). Value = "value found" end if end sub   

In a single workbook, the results are simplified for just one sheet:

 Enter image details here

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -