Excel 2010 VBA Tutorial 38 - Events - Worksheet Activation & Deactivation

preview_player
Показать описание
Setting code to run when you switch to and from a worksheet.
Рекомендации по теме
Комментарии
Автор

yeh, use the worksheet.activate function.

YourprogrammingnetworkCoUk
Автор

Is it possible to switch worksheet after. say, hitting yes on the msgbox?

chrisbrannin
Автор

I am trying a simple code based on Worksheet change event

I have some cells filled with numbers (including 2). Not sure why the code isn't working. Can you please what's missing?

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False

For Each Cell In Target.Cells
If cl.Value = 2 Then
cl.Value = 3
End If

Next Cell

Application.EnableEvents = True

End Sub

dnyaneshdeshpande
Автор

what does "Application.EnableEvents = False" and "Application.EnableEvents = True"

soustitrejawad