![]() |
this is code that down excel
i need sheet code copy many sheets from a sheet except specific sheets
only, for example, sheet name is the Curr2, xCurr, Curr3. but , unhappinesly this code exit xl program. Sub sbVBECopyEvnt(wb, sSrc) Dim x As VBIDE.VBComponent Dim codModul As VBIDE.CodeModule With wb.VBProject Set codModul = .VBComponents.Item(sSrc.CodeName).CodeModule srCodSrc = codModul.Lines(1, codModul.CountOfLines) For Each x In .VBComponents If x.Type = vbext_ct_Document Then 'x.name==thisworkbook, sheet2... namSht = x.Properties("name") If x.Name < "ThisWorkbook" And sSrc.CodeName < x.Name And _ CBool(InStr(1, namSht, "Curr")) = False Then x.CodeModule.DeleteLines 1, x.CodeModule.CountOfLines x.CodeModule.AddFromString srCodSrc End If End If Next End With End Sub Sub sbVBECopyEvnt_tst() Call sbVBECopyEvnt(ActiveWorkbook, ActiveWorkbook.Sheets("01")) End Sub *** Sent via Developersdex http://www.developersdex.com *** |
All times are GMT +1. The time now is 12:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com