i have macros generates number of workbooks. macros, @ start of run, check if file contains 2 spreadsheets, , delete them if exist.
the code tried was:
if sheet.name = "id sheet" application.displayalerts = false sheet.delete application.displayalerts = true end if if sheet.name = "summary" application.displayalerts = false sheet.delete application.displayalerts = true end if this code returning error:
run time error #424, object required.
i have wrong formatting, if there easier way this, useful.
consider:
sub sheetkiller() dim s worksheet, t string dim long, k long k = sheets.count = k 1 step -1 t = sheets(i).name if t = "id sheet" or t = "summary" application.displayalerts = false sheets(i).delete application.displayalerts = true end if next end sub note:
because deleting, run loop backwards.
Comments
Post a Comment