Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Following are the sheet names containing in workbook: Sheet1, Temp1, Test1, Check1, Sheet2, Test2, Work2, Pend2 Here if removed digits from sheet names, then: Sheet1 matches Sheet2 Test1 matches Test2 And non matching names a Temp1, Check1, Work2, Pend2 So, what i actually need is to delete these all non matching sheet through vba +------------------------------------------------------------------- |Filename: RmvSheets.zip |Download: http://www.excelforum.com/attachment.php?postid=3670 +------------------------------------------------------------------- -- ilyaskaz ----------------------------------------------------------------------- ilyaskazi's Profile: http://www.excelforum.com/member.php...fo&userid=2396 View this thread: http://www.excelforum.com/showthread.php?threadid=39291 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This is crude code (untested). But the idea is to check each worksheet
against all the other sheets. If no match is found than delete the worksheet. Dim ws as Worksheet, wsn as String, wsi as Integer, i as integer, x as integer For each ws in Activeworkbook.Worksheets x = 0 wsn = Left(ws.name,len(ws.name)-1) wsi = ws.Index for i = 1 to Activeworkbook.Worksheets.Count if i < wsi then If Left(Sheets(i).name,len(Sheets(i).name)-1) = wsn x = 1 end if next If x = 0 then ws.delete end if Next -- steveB Remove "AYN" from email to respond "ilyaskazi" wrote in message ... Following are the sheet names containing in workbook: Sheet1, Temp1, Test1, Check1, Sheet2, Test2, Work2, Pend2 Here if removed digits from sheet names, then: Sheet1 matches Sheet2 Test1 matches Test2 And non matching names a Temp1, Check1, Work2, Pend2 So, what i actually need is to delete these all non matching sheets through vba. +-------------------------------------------------------------------+ |Filename: RmvSheets.zip | |Download: http://www.excelforum.com/attachment.php?postid=3670 | +-------------------------------------------------------------------+ -- ilyaskazi ------------------------------------------------------------------------ ilyaskazi's Profile: http://www.excelforum.com/member.php...o&userid=23969 View this thread: http://www.excelforum.com/showthread...hreadid=392911 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Excellent!!! I hv checked and working perfect as per my requirement. thankyou steve -- ilyaskaz ----------------------------------------------------------------------- ilyaskazi's Profile: http://www.excelforum.com/member.php...fo&userid=2396 View this thread: http://www.excelforum.com/showthread.php?threadid=39291 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You are very welcome!
-- steveB Remove "AYN" from email to respond "ilyaskazi" wrote in message ... Excellent!!! I hv checked and working perfect as per my requirement. thankyou steve. -- ilyaskazi ------------------------------------------------------------------------ ilyaskazi's Profile: http://www.excelforum.com/member.php...o&userid=23969 View this thread: http://www.excelforum.com/showthread...hreadid=392911 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do i compare and remove common names from 2 excel work sheets | Excel Worksheet Functions | |||
VBA Code Required for deleting All Sheets except Sheet1 | Excel Discussion (Misc queries) | |||
need help, want to remove some sheets | Excel Worksheet Functions | |||
How do i remove workbooks no longer required | Excel Discussion (Misc queries) | |||
Remove transition between sheets | Excel Programming |