运行宏后,我的主要Excel功能不活动... 即。我不能改变文字的颜色,一切都很慢, 还有什么我应该打开/关闭以恢复正常操作? 当我关闭并打开时,一切似乎都是正确的。 这是我脚本末尾的文字。 我很感激你的帮助。
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
Application.CutCopyMode = False
Application.Calculate
Option Explicit
Sub Room_Results_up2_Click()
Room_Results_up2 (False)
End Sub
Sub Room_Results_up2(ScreenUpdate As Boolean)
Dim ws As Worksheet
Dim zonecount As Long
If ScreenUpdate = False Then
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Application.DisplayStatusBar = False
End If
Room_ResultsCopy False, False
TempUpdt False, False
TempUpdt2 False, False
Dim zakres As Range
Set zakres = Sheets("Room_Results").Columns("B")
Set zakres = zakres.SpecialCells(xlCellTypeConstants, xlTextValues)
If zakres.CountLarge = 0 Then Exit Sub
Dim kolumna As Long
Dim ileKolumn As Long
Dim komorka As Range
Dim wynik As Variant
ileKolumn = Range("B:CB").Columns.count
Dim f As Range '1
For Each komorka In zakres
For kolumna = 2 To ileKolumn
wynik = BezpVLOOKUP(komorka.Value, Sheets("Room_ResultsCopy").Range("B:BZ"), kolumna, False)
If wynik <> "" Then
Set f = Sheets("Room_ResultsCopy").Cells.Find(komorka.Value)
Sheets("Room_ResultsCopy").Cells(f.Row, kolumna + 1).Copy
Sheets("Room_Results").Cells(komorka.Row, kolumna + 1).PasteSpecial xlPasteAll
Sheets("Room_Results").Cells(komorka.Row, kolumna + 1).Interior.Color = RGB(255, 255, 0)
End If
Next kolumna
Next komorka
Room_Results_RangeNames.Room_Results_RangeNames
If ScreenUpdate = False Then
Application.DisplayStatusBar = True
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End If
zonecount = Sheets("Room_Results").Cells(Rows.count, "C").End(xlUp).Row
MsgBox "Update Done! " & vbNewLine & "Nr of Rows = " & zonecount & vbNewLine & "...by Michal"
Worksheets("Room_Results").Range("D10").Activate
End Sub