|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
我有一个文件,它现在的大小是100多兆,然后我一开始以为是空行太多导致的问题,但是发现不是
然后我复制了副本一个个试验删除工作表,发现其中有 一个工作表删掉之后整个文件变成了4M,那么问题来了,这个工作表,它的内容不多,vb的代码如下:
- Private Sub CommandButton1_Click()
- 'On Error Resume Next
- Application.ScreenUpdating = False
- With Application
- .Calculation = xlManual
- .MaxChange = 0.001
- End With
-
- a = MsgBox("是否确认需要更新装配计划?", vbYesNo, "添加确认")
- If a = 6 Then
- b = Worksheets("装配记录").Cells(1, 1).CurrentRegion.Rows.Count + 1
- d = ActiveSheet.Cells(1, 1).CurrentRegion.Rows.Count
- For i = 2 To d
- If Cells(i, 1) <> "" Then
- If Cells(i, 8) <> "" Then
- For n = 1 To 8
- Worksheets("装配记录").Cells(b, n) = Cells(i, n)
- Next n
-
- Worksheets("装配记录").Cells(b, 15) = Cells(i, 15)
-
- Rows(i).Delete
-
- b = b + 1
- End If
-
- Else
- 'Exit Sub
- End If
- Next i
- Call CommandButton2_Click
- Else
- MsgBox "取消装配计划添加"
- End If
- Worksheets("装配记录").Cells(1, 1).Calculate
- With Application
- .Calculation = xlAutomatic
- .MaxChange = 0.001
- End With
- Application.ScreenUpdating = True
- End Sub
- Private Sub CommandButton2_Click()
- 'Application.ScreenUpdating = True
- 'With Application
- ' .Calculation = xlManual
- ' .MaxChange = 0.001
- 'End With
- '清空装配计划
- 'a = MsgBox("确认需要清空装配计划吗?", vbYesNo, "清空警告")
- 'If a = 6 Then
- 'Range("a2:z500").ClearContents
- 'Else
- 'MsgBox "取消清空!"
- 'End If
- 'With Application
- ' .Calculation = xlAutomatic
- ' .MaxChange = 0.001
- 'End With
- 'Application.ScreenUpdating = True
- End Sub
- Private Sub CommandButton3_Click()
- If MsgBox("是否打印", vbYesNo) = 6 Then
- ActiveSheet.PrintOut
- 'Call CommandButton1_Click
- ThisWorkbook.Save
- Else
- MsgBox "取消打印!"
- End Sub
- Private Sub Worksheet_Activate()
- On Error Resume Next
- ActiveWindow.FreezePanes = False
- Range("D2").Select
- ActiveWindow.FreezePanes = True
- End Sub
- Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
- '双击打开链接的标准定单
- On Error Resume Next
- ActiveWorkbook.FollowHyperlink Address:="\\192.168.2.3\定单管理" & Mid(ThisWorkbook.Name, 6, 4) & "\标准定单" & Cells(Target.Row, 15), NewWindow:=True
- End Sub
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- End Sub
复制代码 然后删掉该工作表呢,整个工作簿文件小了
但是我把这个工作表移动到其他的工作簿里面,整个工作簿又没有变的非常大,有技术大大知道这个问题吗?
无奈这个文件因为涉及到公司的订单问题,无法发出来,只能发上面的代码
|
|