Worksheet Events - Worksheet Before delete event

Excel VBA for Beginners Events in Excel VBA
1 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
€85.87
List Price:  €120.23
You save:  €34.35
£74.39
List Price:  £104.15
You save:  £29.76
CA$138.18
List Price:  CA$193.46
You save:  CA$55.28
A$153.39
List Price:  A$214.75
You save:  A$61.36
S$128.92
List Price:  S$180.49
You save:  S$51.57
HK$779.80
List Price:  HK$1,091.76
You save:  HK$311.95
CHF 80.49
List Price:  CHF 112.70
You save:  CHF 32.20
NOK kr1,009.67
List Price:  NOK kr1,413.58
You save:  NOK kr403.91
DKK kr641.01
List Price:  DKK kr897.45
You save:  DKK kr256.43
NZ$170.65
List Price:  NZ$238.92
You save:  NZ$68.26
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,159.63
List Price:  ৳17,023.97
You save:  ৳4,864.33
₹8,813.74
List Price:  ₹12,339.59
You save:  ₹3,525.84
RM422.70
List Price:  RM591.80
You save:  RM169.10
₦152,684.73
List Price:  ₦213,764.73
You save:  ₦61,080
₨28,172.18
List Price:  ₨39,442.18
You save:  ₨11,270
฿3,233.20
List Price:  ฿4,526.62
You save:  ฿1,293.41
₺4,116.73
List Price:  ₺5,763.58
You save:  ₺1,646.85
B$546.03
List Price:  B$764.47
You save:  B$218.43
R1,779.46
List Price:  R2,491.32
You save:  R711.85
Лв167.77
List Price:  Лв234.89
You save:  Лв67.11
₩139,375.48
List Price:  ₩195,131.24
You save:  ₩55,755.76
₪336.41
List Price:  ₪470.99
You save:  ₪134.57
₱5,711.89
List Price:  ₱7,996.87
You save:  ₱2,284.98
¥14,830.67
List Price:  ¥20,763.54
You save:  ¥5,932.86
MX$1,876.23
List Price:  MX$2,626.81
You save:  MX$750.57
QR364.02
List Price:  QR509.64
You save:  QR145.62
P1,342.46
List Price:  P1,879.50
You save:  P537.04
KSh12,918.70
List Price:  KSh18,086.70
You save:  KSh5,168
E£4,854.20
List Price:  E£6,796.08
You save:  E£1,941.87
ብር14,292.55
List Price:  ብር20,010.15
You save:  ብር5,717.59
Kz91,186.39
List Price:  Kz127,664.59
You save:  Kz36,478.20
CLP$96,831.31
List Price:  CLP$135,567.71
You save:  CLP$38,736.40
CN¥713
List Price:  CN¥998.24
You save:  CN¥285.23
RD$6,296.92
List Price:  RD$8,815.94
You save:  RD$2,519.02
DA12,990.59
List Price:  DA18,187.34
You save:  DA5,196.75
FJ$226.12
List Price:  FJ$316.58
You save:  FJ$90.46
Q765.93
List Price:  Q1,072.34
You save:  Q306.40
GY$20,890.84
List Price:  GY$29,248.01
You save:  GY$8,357.17
ISK kr12,333.76
List Price:  ISK kr17,267.76
You save:  ISK kr4,934
DH908.31
List Price:  DH1,271.67
You save:  DH363.36
L1,670.58
List Price:  L2,338.87
You save:  L668.29
ден5,277.34
List Price:  ден7,388.49
You save:  ден2,111.14
MOP$802.43
List Price:  MOP$1,123.43
You save:  MOP$321
N$1,761.48
List Price:  N$2,466.14
You save:  N$704.66
C$3,674.73
List Price:  C$5,144.77
You save:  C$1,470.03
रु14,082.30
List Price:  रु19,715.79
You save:  रु5,633.48
S/353.21
List Price:  S/494.51
You save:  S/141.30
K416.61
List Price:  K583.27
You save:  K166.66
SAR375.17
List Price:  SAR525.25
You save:  SAR150.08
ZK2,374.72
List Price:  ZK3,324.71
You save:  ZK949.98
L436.04
List Price:  L610.48
You save:  L174.43
Kč2,099.65
List Price:  Kč2,939.59
You save:  Kč839.94
Ft33,821.21
List Price:  Ft47,351.04
You save:  Ft13,529.83
SEK kr945.93
List Price:  SEK kr1,324.34
You save:  SEK kr378.41
ARS$136,092.68
List Price:  ARS$190,535.20
You save:  ARS$54,442.52
Bs690.01
List Price:  Bs966.04
You save:  Bs276.03
COP$400,414.31
List Price:  COP$560,596.05
You save:  COP$160,181.74
₡50,481.69
List Price:  ₡70,676.39
You save:  ₡20,194.69
L2,617.73
List Price:  L3,664.93
You save:  L1,047.20
₲721,217.97
List Price:  ₲1,009,734.02
You save:  ₲288,516.04
$U4,006.62
List Price:  $U5,609.43
You save:  $U1,602.81
zł365.33
List Price:  zł511.47
You save:  zł146.14
Already have an account? Log In

Transcript

Okay guys, so now we're going to speak about the before delete event. And as the name suggests, it executes some VBA code before each sheet is deleted. So I have created here a sheet called before delete event. Okay, I'm just going to right click and go to View code to go to the events for that sheet. I'm going to select worksheet here and then I'm going to select before Delete to be my event. I'm gonna delete this worksheet, selection change event.

And we can have a message box appear that says bye bye for example. Okay, and I'm going to close that. If we delete the sheet here. You can see here that the code has not been executed yet. When you click on delete, okay, you will see actually that the message box will appear before the sheet disappears. Okay.

So this is why it's called the before delete. Because the code will be executed before deleting the sheet. Okay, so you can see here, message box has appeared, the sheet still exists, you click OK, she disappears. I've never used this before. I'm not sure why you would want to use it. Okay?

But, you know if you have an idea and there's something that you that this would be useful in, in a certain application in your work or so, just let me know. I'd be interested. Thank you very much.

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.