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
€84.92
List Price:  €118.90
You save:  €33.97
£74.06
List Price:  £103.69
You save:  £29.62
CA$136.81
List Price:  CA$191.54
You save:  CA$54.73
A$148.86
List Price:  A$208.41
You save:  A$59.55
S$128.39
List Price:  S$179.76
You save:  S$51.36
HK$777.09
List Price:  HK$1,087.96
You save:  HK$310.87
CHF 78.91
List Price:  CHF 110.47
You save:  CHF 31.56
NOK kr1,000.83
List Price:  NOK kr1,401.21
You save:  NOK kr400.37
DKK kr634.47
List Price:  DKK kr888.29
You save:  DKK kr253.81
NZ$171.30
List Price:  NZ$239.83
You save:  NZ$68.52
د.إ367.21
List Price:  د.إ514.11
You save:  د.إ146.90
৳12,220.44
List Price:  ৳17,109.11
You save:  ৳4,888.66
₹8,977.71
List Price:  ₹12,569.16
You save:  ₹3,591.44
RM404.80
List Price:  RM566.74
You save:  RM161.94
₦145,094.48
List Price:  ₦203,138.08
You save:  ₦58,043.60
₨28,013.30
List Price:  ₨39,219.75
You save:  ₨11,206.44
฿3,107.58
List Price:  ฿4,350.74
You save:  ฿1,243.15
₺4,283.32
List Price:  ₺5,996.82
You save:  ₺1,713.49
B$554.37
List Price:  B$776.14
You save:  B$221.77
R1,666.63
List Price:  R2,333.35
You save:  R666.72
Лв166.02
List Price:  Лв232.43
You save:  Лв66.41
₩144,218.57
List Price:  ₩201,911.77
You save:  ₩57,693.20
₪319.22
List Price:  ₪446.92
You save:  ₪127.70
₱5,870.26
List Price:  ₱8,218.60
You save:  ₱2,348.33
¥15,655.93
List Price:  ¥21,918.93
You save:  ¥6,263
MX$1,790.90
List Price:  MX$2,507.33
You save:  MX$716.43
QR364.51
List Price:  QR510.32
You save:  QR145.81
P1,314.55
List Price:  P1,840.43
You save:  P525.87
KSh12,893.71
List Price:  KSh18,051.71
You save:  KSh5,158
E£4,754.90
List Price:  E£6,657.05
You save:  E£1,902.15
ብር15,558.93
List Price:  ብር21,783.13
You save:  ብር6,224.19
Kz91,219.48
List Price:  Kz127,710.93
You save:  Kz36,491.44
CLP$90,580.94
List Price:  CLP$126,816.94
You save:  CLP$36,236
CN¥700.59
List Price:  CN¥980.86
You save:  CN¥280.26
RD$6,268.37
List Price:  RD$8,775.97
You save:  RD$2,507.60
DA12,969.49
List Price:  DA18,157.81
You save:  DA5,188.31
FJ$226.89
List Price:  FJ$317.66
You save:  FJ$90.76
Q766.16
List Price:  Q1,072.65
You save:  Q306.49
GY$20,921.62
List Price:  GY$29,291.11
You save:  GY$8,369.48
ISK kr12,571.74
List Price:  ISK kr17,600.94
You save:  ISK kr5,029.20
DH912.39
List Price:  DH1,277.39
You save:  DH364.99
L1,677.58
List Price:  L2,348.67
You save:  L671.09
ден5,227.78
List Price:  ден7,319.11
You save:  ден2,091.32
MOP$801.02
List Price:  MOP$1,121.47
You save:  MOP$320.44
N$1,664.35
List Price:  N$2,330.15
You save:  N$665.80
C$3,680.29
List Price:  C$5,152.56
You save:  C$1,472.26
रु14,368.75
List Price:  रु20,116.83
You save:  रु5,748.07
S/336.50
List Price:  S/471.12
You save:  S/134.61
K431.86
List Price:  K604.62
You save:  K172.76
SAR375.20
List Price:  SAR525.30
You save:  SAR150.09
ZK2,257.52
List Price:  ZK3,160.62
You save:  ZK903.09
L432.46
List Price:  L605.47
You save:  L173
Kč2,058.75
List Price:  Kč2,882.33
You save:  Kč823.58
Ft32,856.71
List Price:  Ft46,000.71
You save:  Ft13,144
SEK kr915.69
List Price:  SEK kr1,282.01
You save:  SEK kr366.31
ARS$145,090.96
List Price:  ARS$203,133.16
You save:  ARS$58,042.19
Bs692.55
List Price:  Bs969.60
You save:  Bs277.04
COP$376,785.69
List Price:  COP$527,515.04
You save:  COP$150,729.35
₡49,946.85
List Price:  ₡69,927.60
You save:  ₡19,980.74
L2,635.99
List Price:  L3,690.49
You save:  L1,054.50
₲677,713.63
List Price:  ₲948,826.20
You save:  ₲271,112.56
$U3,919.50
List Price:  $U5,487.46
You save:  $U1,567.95
zł357.96
List Price:  zł501.17
You save:  zł143.20
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.