如果范围内的任何单元格都被更改(C5至C25),我试图使宏自动运行。
如您在下面的代码中看到的,它应该自动弹出一个消息框,询问用户是否继续(如果用户说是,则运行宏)。
一旦更改了任何一个单元(从c5到c25),我都无法使代码开始运行。
这是代码-这不是我自己的全部:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Target.Worksheet.Range("C5:C25")) Is Nothing Then Reminder
End Sub
Sub Reminder()
'
' Reminder Macro
'
response = MsgBox("Do you want to set a reminder in Outlook for when the next update is required? If yes, make sure your Microsoft Outlook is open.", vbYesNo)
If response = vbNo Then
MsgBox ("You selected 'No'")
Exit Sub
End If
'Rest of my macro code goes here...
End sub
谢谢!
确保您的代码在工作表的代码模块中。从上面的注释中,您可以表明它位于模块3中。需要将其移至工作表的代码模块中。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句