I wrote this code which is part of a Select Case
statement. It searches for a term variable (find_Element
) and then pastes it to another worksheet
and another cell
.
Case 1
find_Element = "Finished goods, net"
For k = 3 To last_WS
With Sheets(k).Range("1:200")
sh_Name = Worksheets(k).Name
'sh_Name = Replace(sh_Name, "_", " ")
Set pointer_to_Element = .Find(find_Element, _
.Cells(.Cells.Count), xlValues, xlWhole, xlByRows, _
xlNext, False)
pointer_Int_Row = CInt(pointer_to_Element.Row)
Worksheets(k).Cells(pointer_Int_Row, lock_Array(k)).Copy
Worksheets("EXTRACTIONS").Range("B12").Offset(, q).PasteSpecial xlPasteValues
Worksheets("EXTRACTIONS").Range("B11").Offset(, q).Value = sh_Name
q = q + 1
End With
Next k
q = 1
However many elements like this one have micro-variations in naming that render my code useless.
For example sometimes the worksheet
instead of having Finished goods, net
in the cell
we are looking for it has Finished goods
or Finished goods,
....
How can i adjust my code to enable him to find the element and not be derailed by such micromodifications in the reports i am receiving?