VBA Excel Sheet Method doesn't work after Office updates -
i have script takes datas csv file , after generates graphic. after many office updates script has finished work. isn't possible come office version.
this code:
dim sheet each sheet in activeworkbook.sheets select case sheet.name case "archive": sheets(sheet.name).delete case "trend": sheets(sheet.name).delete case "pivottable": sheets(sheet.name).delete end select next
i receive follow error: "application defined or object defined error". error arrives on select case, because object "sheet" hasn't method "name".
i have tryed declare "sheet" worksheet
dim sheet worksheet each sheet in activeworkbook.sheets select case sheet.name case "archive": sheets(sheet.name).delete case "trend": sheets(sheet.name).delete case "pivottable": sheets(sheet.name).delete end select next
at first cicle of script haven't problem, second cicle have error: "type mismatch"
how can solve it?
thanks
note: not answer, long write down comment.
you can keep coding lot cleaner , simplier: prefer not use sheet
it's similer sheet
. also, it's better if avoid using activeworkbook
.
dim sht worksheet each sht in activeworkbook.sheets select case sht.name case "archive", "trend", "pivottable" sht.delete end select next sht
Comments
Post a Comment