Excel高亮选中行列

时间:2021-10-21 03:05:09
【文件属性】:

文件名称:Excel高亮选中行列

文件大小:187KB

文件格式:ZIP

更新时间:2021-10-21 03:05:09

Excel

Sub 复制() 'sheet1中的代码复制到激活工作表中的工作表对象中     Dim wb As Workbook, vb1, vb2, str$     Application.ScreenUpdating = False     For Each wb In Workbooks         If wb.Name <> ThisWorkbook.Name Then wb.Close True     Next     Set wb = Workbooks.Open(ThisWorkbook.Path & "\测试.xlsm")     Set vb1 = wb.VBProject.VBComponents("Sheet1")     Set vb2 = ThisWorkbook.VBProject.VBComponents("Sheet1")     str = vb2.CodeModule.Lines(1, vb2.CodeModule.CountOfLines)     vb1.CodeModule.DeleteLines 1, vb1.CodeModule.CountOfLines     vb1.CodeModule.AddFromString str     Workbooks("动态高亮.xlsm").Close False     Application.ScreenUpdating = True     '复制完之后,关闭这个工作表 End Sub Sub 删除() '将激活工作表中的工作表对象中的代码删除     Dim wb As Workbook     Application.ScreenUpdating = False     For Each wb In Workbooks         If wb.Name <> ThisWorkbook.Name Then wb.Close True     Next     Set wb = Workbooks.Open(ThisWorkbook.Path & "\测试.xlsm")     With wb.VBProject.VBComponents("Sheet1")         .CodeModule.DeleteLines 1, .CodeModule.CountOfLines     End With     wb.Sheets(1).Cells.FormatConditions.Delete     Workbooks("动态高亮.xlsm").Close SaveChanges:=False     Application.ScreenUpdating = False     '删除之后,关闭这个工作表 End Sub


【文件预览】:
动态高亮.xlsm
103428c20z6c63ru1tt1o9.jpg
100328i52hp6ypy614yvuw.jpg

网友评论