ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   deleting selected worksheets using vb code (https://www.excelbanter.com/excel-discussion-misc-queries/116848-deleting-selected-worksheets-using-vbulletin-code.html)

George

deleting selected worksheets using vb code
 
Can anybody tell how do I deleted selected worksheets using vb codes. The
whole code would also include clear contents of a number of cells in Sheet(2)
and deleting all sheets after sheet(2).
Thank you.
--
George

Dave Peterson

deleting selected worksheets using vb code
 
Maybe this'll get you started:

Option Explicit
Sub testme()

Dim iCtr As Long

Application.DisplayAlerts = False
For iCtr = Sheets.Count To Sheets("Sheet(2)").Index + 1 Step -1
Sheets(iCtr).Delete
Next iCtr

Worksheets("Sheet(2)").Range("a1:b3,c9,d12:e99").C learContents

End Sub


George wrote:

Can anybody tell how do I deleted selected worksheets using vb codes. The
whole code would also include clear contents of a number of cells in Sheet(2)
and deleting all sheets after sheet(2).
Thank you.
--
George


--

Dave Peterson


All times are GMT +1. The time now is 09:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com