我是很新,VBA,但我已经通过这些论坛阅读发现在我的方式。我从来没有遇到与Application.ScreenUpdating不工作,并经过在线研究的问题,我无法找到我的问题的答案。Application.ScreenUpdating不会更改为false
我创建在Excel中给出了每日清单一个月视图中的每日清单中的应用。这些任务按行排队,您只需在日历上选择该任务的yes,no或N/a。您可以保存清单,并将信息复制到单独的选项卡中的数据表。除了在保存信息时Application.Screenupdating不起作用并且用户最终看到数据表和日历视图之间的闪烁和跳来跳去之外,一切都很完美。
为什么Application.ScreenUpdating没有改变,以虚假的任何意见或指导?我尝试过在不同的区域移动它,但似乎没有任何工作。
这里的保存清单子:
Sub Save_Checklist()
Dim Checklist_Date
Dim Completed As Long
Dim Left_to_Complete As Long
Dim Database_Date As Range
Dim Database_Row As Long
Dim bScrUpdate
bScrUpdate = Application.ScreenUpdating
If bScrUpdate = True Then Application.ScreenUpdating = False
Worksheets("Database").Unprotect Password:="youngC"
If MsgBox("This button will save this month's checklist data into the database. All previous information will be overwritten. Would you like to continue?", vbYesNoCancel, "Reset the Calender") = vbYes Then
Checklist_Date = Worksheets("Daily Checklist").Range("E4").Value
Add_to = Worksheets("Daily Checklist").Range("AL1").Value
Range("E55").Select
ActiveCell.Resize(2, Add_to).Select
Selection.Copy
On Error Resume Next
With Worksheets("Database").Activate
Range("A1:A366").Select
Selection.Find(What:=Checklist_Date, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Select
On Error GoTo 0
If Not Database_Date Is Nothing Then Application.Goto Database_Date, True
End With
Selection.Offset(0, 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Worksheets("Database").Protect Password:="youngC"
Else
MsgBox ("Please be sure all information is correct before saving it.")
End If
If Not Application.ScreenUpdating = bScrUpdate _
Then Application.ScreenUpdating = bScrUpdate
End Sub
这是我在打开工作簿上运行的代码(我已在“添加任务到月的日历”片分组):
Private Sub Workbook_Open()
Worksheets("Main Menu").Activate
With Worksheets("Add Tasks to Month's Calendars")
.EnableOutlining = True
.Protect Password:="youngC", _
Contents:=True, UserInterfaceOnly:=True
End With
End Sub
任何帮助都将不胜感激。
谢谢, 克里斯
你的标题说它不会变成'FALSE',但你的问题说它不起作用。这是什么? –
另外,我不认为它做任何伤害,但设置了'Boolean'值'FALSE'如果是TRUE;是一样,它设置为'FALSE',所以你可以缩短代码,这两条线。 –
我对问题中的误解表示歉意。宏运行得很好,所以代码工作。 Application.Screenupdating = False不起作用,因此当用户单击分配给此宏的按钮时,屏幕会更改。 –