Enabling and Disabling Events

Excel VBA for Beginners Events in Excel VBA
2 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€88.58
List Price:  €124.02
You save:  €35.43
£75.39
List Price:  £105.55
You save:  £30.15
CA$138.74
List Price:  CA$194.24
You save:  CA$55.50
A$155.80
List Price:  A$218.13
You save:  A$62.32
S$129.67
List Price:  S$181.55
You save:  S$51.87
HK$777.12
List Price:  HK$1,088
You save:  HK$310.88
CHF 82.59
List Price:  CHF 115.63
You save:  CHF 33.04
NOK kr1,035.02
List Price:  NOK kr1,449.07
You save:  NOK kr414.05
DKK kr660.90
List Price:  DKK kr925.29
You save:  DKK kr264.38
NZ$168.68
List Price:  NZ$236.16
You save:  NZ$67.47
د.إ367.26
List Price:  د.إ514.18
You save:  د.إ146.91
৳12,188.92
List Price:  ৳17,064.98
You save:  ৳4,876.05
₹8,559.47
List Price:  ₹11,983.61
You save:  ₹3,424.13
RM427.95
List Price:  RM599.15
You save:  RM171.20
₦160,939.90
List Price:  ₦225,322.30
You save:  ₦64,382.40
₨28,187.10
List Price:  ₨39,463.07
You save:  ₨11,275.97
฿3,282.32
List Price:  ฿4,595.38
You save:  ฿1,313.06
₺3,863.49
List Price:  ₺5,409.04
You save:  ₺1,545.55
B$574.43
List Price:  B$804.22
You save:  B$229.79
R1,818.24
List Price:  R2,545.62
You save:  R727.37
Лв172.73
List Price:  Лв241.83
You save:  Лв69.10
₩140,122.74
List Price:  ₩196,177.44
You save:  ₩56,054.70
₪357.72
List Price:  ₪500.82
You save:  ₪143.10
₱5,563.24
List Price:  ₱7,788.76
You save:  ₱2,225.51
¥14,477.35
List Price:  ¥20,268.87
You save:  ¥5,791.52
MX$1,957.65
List Price:  MX$2,740.78
You save:  MX$783.13
QR364.06
List Price:  QR509.70
You save:  QR145.64
P1,361.73
List Price:  P1,906.48
You save:  P544.74
KSh12,933.70
List Price:  KSh18,107.70
You save:  KSh5,174
E£5,063.12
List Price:  E£7,088.57
You save:  E£2,025.45
ብር13,459.34
List Price:  ብር18,843.61
You save:  ብር5,384.27
Kz91,190.88
List Price:  Kz127,670.88
You save:  Kz36,480
CLP$94,573.54
List Price:  CLP$132,406.74
You save:  CLP$37,833.20
CN¥722.46
List Price:  CN¥1,011.47
You save:  CN¥289.01
RD$5,902.61
List Price:  RD$8,263.89
You save:  RD$2,361.28
DA13,292.52
List Price:  DA18,610.06
You save:  DA5,317.54
FJ$225.87
List Price:  FJ$316.23
You save:  FJ$90.35
Q770.30
List Price:  Q1,078.46
You save:  Q308.15
GY$20,924.33
List Price:  GY$29,294.90
You save:  GY$8,370.57
ISK kr12,977.70
List Price:  ISK kr18,169.30
You save:  ISK kr5,191.60
DH926.13
List Price:  DH1,296.62
You save:  DH370.49
L1,709.38
List Price:  L2,393.20
You save:  L683.82
ден5,417.58
List Price:  ден7,584.83
You save:  ден2,167.25
MOP$801.19
List Price:  MOP$1,121.71
You save:  MOP$320.51
N$1,867.19
List Price:  N$2,614.14
You save:  N$746.95
C$3,690.56
List Price:  C$5,166.94
You save:  C$1,476.37
रु13,561.38
List Price:  रु18,986.48
You save:  रु5,425.09
S/367.72
List Price:  S/514.83
You save:  S/147.10
K405.78
List Price:  K568.11
You save:  K162.33
SAR375.04
List Price:  SAR525.08
You save:  SAR150.03
ZK2,781.79
List Price:  ZK3,894.63
You save:  ZK1,112.83
L453.82
List Price:  L635.37
You save:  L181.54
Kč2,209.09
List Price:  Kč3,092.81
You save:  Kč883.72
Ft35,959.45
List Price:  Ft50,344.68
You save:  Ft14,385.22
SEK kr966.22
List Price:  SEK kr1,352.75
You save:  SEK kr386.53
ARS$114,487.54
List Price:  ARS$160,287.14
You save:  ARS$45,799.59
Bs693.19
List Price:  Bs970.49
You save:  Bs277.30
COP$433,202.44
List Price:  COP$606,500.75
You save:  COP$173,298.30
₡50,658.12
List Price:  ₡70,923.39
You save:  ₡20,265.27
L2,602.65
List Price:  L3,643.81
You save:  L1,041.16
₲803,267.16
List Price:  ₲1,124,606.16
You save:  ₲321,338.99
$U4,177.30
List Price:  $U5,848.39
You save:  $U1,671.08
zł378.16
List Price:  zł529.44
You save:  zł151.28
Already have an account? Log In

Transcript

Hey guys, welcome back. So in this video we're going to discuss how we can disable events and how we can re enable them again, okay, so if we disable the events, anything that is triggered as a result of an event is not going to be triggered okay? So any code that is triggered for example, by double clicking a cell will not be triggered, okay, events are disabled, this feature in Excel will be disabled and we will see why we're going to need to use that. Okay, but first of all to disable an event you can write application dot enable events equals false, okay? This is how you can disable events and to re enable them again you can write application enable events equals true Okay, so if you run the first line of code here for the disabled events Sub procedure, if you run that, events will be disabled.

So for example on this before double click sheet here, where we actually explained it before double click event and we said that if we double click on any of these names, it will be transferred to cell three, this will not happen, okay? Because events are disabled. So any code that is triggered as a result of a certain action will be disabled. Okay, so to re enable the events again and re enable that feature, you can just run the application, enable events equals true so if you run that, and we just double click here you can see are the names are being transferred to cell l three, okay, so the events are now working. And of course you can include these lines are lines of code in any procedure that you write even event procedures and we're going to see why these are useful. Okay, if at any point you just want to check if the events are enabled or disabled, not enable them or disable them, but just check.

Are they enabled or disabled at the moment at this moment? Are they enabled or disabled, you can go to your immediate window This is a nice little trick, okay, so you can go to your immediate window here. And if it's not enabled, you can click on view here and then click on immediate window to view it. Okay and write a question mark and then application dot enable events. Okay? Do not write equals true or false or anything just write this question mark application dot enable events and press enter.

It will just tell you is it true or false. So if it's true, then they are enabled. If it's false, then events are disabled. So this is a nice little trick that you can use to check if at a certain moment events are enabled or disabled. And in future videos, we're going to see why enabling and disabling events are useful. Okay, so thanks for watching this video.

I'll see you on the next one.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.