Dear sam, Thanks for your valuable Advice
Regards chandru On Tue, Feb 7, 2012 at 12:22 AM, Sam Mathai Chacko <samde...@gmail.com>wrote: > There is no object model in Excel which tests the use of subtotal in a > worksheet/range. > > The closest you could get is to look whether the used range has something > like an =SUBTOTAL(*) somewhere, and then use the code that I suggested > below. But that would then not be fool proof. The possibility that you used > a SUBTOTAL formula deliberately somewhere cannot be ruled out. > > So to keep it simple, a reasonable solution, but not what old-school VBA > experts would be happy about, would be to use an On Error Resume Next. > Personally speaking, that is also not my kind of recommendation, but until > Microsoft comes out with an object model that checks the existence of > SUBTOTAL in the sheet/range, we have to use this. > > So, just to show how I'd do it out of laziness > > Sub ClearSubTotal() > > On Error Resume Next > > ActiveSheet.UsedRange.RemoveSubtotal > > End Sub > > Regards, > > Sam Mathai Chacko > > On Mon, Feb 6, 2012 at 11:20 PM, chandra sekaran <duraichan...@gmail.com > > wrote: > >> Hi sam, >> >> If Subtotal method is there than only remove subtotal works , in that >> case whether subtotal paticular sheet is there or not if subototal method >> is there i will use below code will work. if not there by pass >> remove subtotal then subtotal commant will work this my query >> >> chandru >> >> >> >> >> On Mon, Feb 6, 2012 at 10:50 PM, Sam Mathai Chacko <samde...@gmail.com>wrote: >> >>> To keep it shorter, and more efficient, one could write >>> >>> Sub ClearSubTotal() >>> >>> ActiveSheet.UsedRange.RemoveSubtotal >>> >>> End Sub >>> >>> Regards, >>> >>> Sam Mathai Chacko >>> >>> >>> On Mon, Feb 6, 2012 at 2:16 PM, Maries <talk2mar...@gmail.com> wrote: >>> >>>> Hi, >>>> ** >>>> *Try this code:* >>>> ** >>>> Sub Macro1() >>>> Cells.Select >>>> Selection.RemoveSubtotal >>>> End Sub >>>> >>>> Regards, >>>> >>>> MARIES. >>>> >>>> On Mon, Feb 6, 2012 at 11:37 AM, chandra sekaran < >>>> duraichan...@gmail.com> wrote: >>>> >>>>> HI ALL >>>>> >>>>> I have write small macro , i want revmove subtotal if Active >>>>> sheet subtotal method is there >>>>> >>>>> >>>>> >>>>> Sub Macro1() >>>>> >>>>> If ActiveSheet.SubtotalMethod = True Then >>>>> Selection.RemoveSubtotal >>>>> End If >>>>> >>>>> End Sub >>>>> >>>>> can any one correct this code >>>>> >>>>> Regards >>>>> chandru >>>>> chennai >>>>> >>>>> -- >>>>> FORUM RULES (986+ members already BANNED for violation) >>>>> >>>>> 1) Use concise, accurate thread titles. Poor thread titles, like >>>>> Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need >>>>> Advice will not get quick attention or may not be answered. >>>>> >>>>> 2) Don't post a question in the thread of another member. >>>>> >>>>> 3) Don't post questions regarding breaking or bypassing any security >>>>> measure. >>>>> >>>>> 4) Acknowledge the responses you receive, good or bad. >>>>> >>>>> 5) Cross-promotion of, or links to, forums competitive to this forum >>>>> in signatures are prohibited. >>>>> >>>>> NOTE : Don't ever post personal or confidential data in a workbook. >>>>> Forum owners and members are not responsible for any loss. >>>>> >>>>> >>>>> ------------------------------------------------------------------------------------------------------ >>>>> To post to this group, send email to excel-macros@googlegroups.com >>>>> >>>> >>>> -- >>>> FORUM RULES (986+ members already BANNED for violation) >>>> >>>> 1) Use concise, accurate thread titles. Poor thread titles, like Please >>>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >>>> will not get quick attention or may not be answered. >>>> >>>> 2) Don't post a question in the thread of another member. >>>> >>>> 3) Don't post questions regarding breaking or bypassing any security >>>> measure. >>>> >>>> 4) Acknowledge the responses you receive, good or bad. >>>> >>>> 5) Cross-promotion of, or links to, forums competitive to this forum in >>>> signatures are prohibited. >>>> >>>> NOTE : Don't ever post personal or confidential data in a workbook. >>>> Forum owners and members are not responsible for any loss. >>>> >>>> >>>> ------------------------------------------------------------------------------------------------------ >>>> To post to this group, send email to excel-macros@googlegroups.com >>>> >>> >>> >>> >>> -- >>> Sam Mathai Chacko >>> >>> -- >>> FORUM RULES (986+ members already BANNED for violation) >>> >>> 1) Use concise, accurate thread titles. Poor thread titles, like Please >>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >>> will not get quick attention or may not be answered. >>> >>> 2) Don't post a question in the thread of another member. >>> >>> 3) Don't post questions regarding breaking or bypassing any security >>> measure. >>> >>> 4) Acknowledge the responses you receive, good or bad. >>> >>> 5) Cross-promotion of, or links to, forums competitive to this forum in >>> signatures are prohibited. >>> >>> NOTE : Don't ever post personal or confidential data in a workbook. >>> Forum owners and members are not responsible for any loss. >>> >>> >>> ------------------------------------------------------------------------------------------------------ >>> To post to this group, send email to excel-macros@googlegroups.com >>> >> >> -- >> FORUM RULES (986+ members already BANNED for violation) >> >> 1) Use concise, accurate thread titles. Poor thread titles, like Please >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >> will not get quick attention or may not be answered. >> >> 2) Don't post a question in the thread of another member. >> >> 3) Don't post questions regarding breaking or bypassing any security >> measure. >> >> 4) Acknowledge the responses you receive, good or bad. >> >> 5) Cross-promotion of, or links to, forums competitive to this forum in >> signatures are prohibited. >> >> NOTE : Don't ever post personal or confidential data in a workbook. Forum >> owners and members are not responsible for any loss. >> >> >> ------------------------------------------------------------------------------------------------------ >> To post to this group, send email to excel-macros@googlegroups.com >> > > > > -- > Sam Mathai Chacko > > -- > FORUM RULES (986+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > ------------------------------------------------------------------------------------------------------ > To post to this group, send email to excel-macros@googlegroups.com > -- FORUM RULES (986+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com