excel - VBA Copy Paste formula search -


code below taken previous question asked

my question - how work if find , search values formulas? ..i've tried changing .value2 doesn't seem work.

vba copy paste string search

with sheets("sheetname") ' change actual sheet name dim r range: set r = .range("c10:g10").find(.range("a10").value2, , , xlwhole) if not r nothing r.offset(4, 0).resize(5).value2 = .range("a14:a18").value2 

end with

enter image description here

if you're looking results of formulas, need specify xlvalues lookin parameter. when it's blank defaults xlformulas. example, find formula results in "bar" (i.e. =concatenate("b","a","r")) on sheet "foo", this:

with activeworkbook.sheets("foo")     dim r range     set r = .usedrange.find("bar", , xlvalues, xlwhole)     if not r nothing         debug.print r.address     end if end 

if want find sheet contains actual formula can either leave out lookin parameter entirely or explicitly specify it:

with activeworkbook.sheets("foo")     dim r range     set r = .usedrange.find("=concatenate(""b"",""a"",""r"")", , _                             xlformulas, xlwhole)     if not r nothing         debug.print r.address     end if end 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -