vba - Run-time Error '1004' - Method "Range' of Object' _ Global' failed -
i try find out in sheet using range.find:
sub grossmargin() dim analysisyear integer analysisyear = 2015 worksheets(activesheet.index + 1).activate set grossmarginloc = range("b1:b100").find("gross margin", , , , , , false) set grossmarginrow = range(grossmarginloc, grossmarginloc.offset(0, 20)) set bsayeartag = range("b1:b20").find("year", , , , , , false) set bsayearrow = range(bsayeartag, bsayeartag.offset(0, 20)) set bsayear = range(bsayearrow).find(analysisyear) '<-- here problem debug.print bsayeartag.address debug.print bsayearrow.address debug.print grossmarginrow.address worksheets(activesheet.index - 1).activate end sub i getting run-time error '1004' - method "range' of object' _ global' failed when attempt run above code. problem appears line set bsayear = range(bsayearrow).find(analysisyear).
what causes error , how can avoid it?
Comments
Post a Comment