Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to deleting spreadsheets in a workbook
Hey guys
My macro uses a pivottablefunction (zoom value) to extract data. This pivot-function creates a new sheet in my workbook, and I'm looking for a methode to make my macro delete this new sheet in the end of the program, when the extract is copied, placed (pasted) and formatted in right position. The problem (my problem) is that the new sheets are automaticly generated by Excel with new index every time the zoomvalue function is activated - so I have to make my macro delete all sheets that is named "sheetxx" (xx is index) - and spare the other ones. This is certainly a small step to life of Excel-VBA-mankind, but a big step to make my day :))) With hopefully regards Snoopy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to deleting spreadsheets in a workbook
Dim s as String, sh as Worksheet
Application.DisplayAlerts = False for each sh in worksheets s = lcase(sh.name) if len(s) 5 then if left(s,5) = "sheet" then sh.Delete end if end if Next Application.DisplayAlerts = True -- Regards, Tom Ogilvy "Snoopy" wrote in message ups.com... Hey guys My macro uses a pivottablefunction (zoom value) to extract data. This pivot-function creates a new sheet in my workbook, and I'm looking for a methode to make my macro delete this new sheet in the end of the program, when the extract is copied, placed (pasted) and formatted in right position. The problem (my problem) is that the new sheets are automaticly generated by Excel with new index every time the zoomvalue function is activated - so I have to make my macro delete all sheets that is named "sheetxx" (xx is index) - and spare the other ones. This is certainly a small step to life of Excel-VBA-mankind, but a big step to make my day :))) With hopefully regards Snoopy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Matching two spreadsheets & deleting "False" matches | Excel Discussion (Misc queries) | |||
Finding and deleting macro in a workbook | Excel Discussion (Misc queries) | |||
deleting all macro/codes from workbook | Excel Programming | |||
Deleting links to other spreadsheets | Excel Worksheet Functions | |||
Deleting a 'workbook' macro | Excel Programming |