vba - Worksheet.Change dows not work when I have two excel files open -


as title says, code not work when have 1 more excel file open @ same time. in first file have code in sheet 1:

private sub worksheet_change(byval target range)  if not intersect(target, range("a1:c" & thisworkbook.worksheets(1).usedrange.rows.count)) nothing call module1.simpleregex end if  end sub 

if close other workbook works fine. tried adding workbooks().activate didn't work.. suggestions?

your range unqualified. try this:

private sub worksheet_change(byval target range)      if not intersect(target, thisworkbook.worksheets(1).range("a1:c" & thisworkbook.worksheets(1).usedrange.rows.count)) nothing         call module1.simpleregex     end if  end sub 

Comments