|
|
|
|
|
|
Excel
|
Prompt message when inserting or deleting a row
|
|
Ease of Use
|
Easy
|
Version tested with
|
5 and later
|
Submitted by:
|
Paleo
|
Description:
|
Everytime you insert or delete a row it will prompt you with a message.
|
Discussion:
|
Sometimes we need to send a message to our user everytime he/she inserts/deletes a row.
|
Code:
|
instructions for use
|
In Module 1:
Public gintRow As Integer
In This_Workbook:
Option Explicit
Private Sub Workbook_Open()
gintRow = Range("Last").Row
End Sub
In Sheet1:
Option Explicit
Private Sub Worksheet_Calculate()
If Range("Last").Row < gintRow Then
MsgBox "The row is deleted!"
ElseIf Range("Last").Row > gintRow Then
MsgBox "The row is added!"
End If
gintRow = Range("Last").Row
End Sub
|
How to use:
|
- Simply use the example file and whenever you insert or delete a row a msgbox will be shown.
|
Test the code:
|
- Copy the above code.
- Open any workbook.
- Press Alt + F11 to open the Visual Basic Editor (VBE).
- From the Menu, choose Insert-Module.
- Paste the code into the stated code window.
- Close the VBE, save the file if desired.
|
Sample File:
|
MessageWhenDeleteOrInsertRows.zip 7.4KB
|
Approved by mdmackillop
|
This entry has been viewed 148 times.
|
|