vba - Searching multiple Excel workbooks for value in same cell and same sheet -
vba - Searching multiple Excel workbooks for value in same cell and same sheet -
i'm learning vba @ new job , assigned project involves checking value in around 100 workbooks. value contained in same cell (i12) in sheet same name in every 1 of 100 workbooks. possible utilize sql somehow pass value 1 cell in each workbook variable can compare them? current code opens each of workbooks compare values, works quite time-consuming.
if it's 1 cell, might want seek executeexcel4macro? like:
sub test() dim fexcel dim fpath string, fval string, aval fpath = "c:\users\user.name\foldername\" '~~> alter suit fexcel = dir(fpath, vbnormal) while fexcel <> "" '~~> sheet1 should sheet name, r12c9 i12 in r1c1 notation fval = "'" & fpath & "[" & fexcel & "]sheet1'!r12c9" aval = executeexcel4macro(fval) '~~> comparing here or dump info in array fexcel = dir loop end sub
excel vba excel-vba
Comments
Post a Comment