VBA – Events

VBA – Events

Events and Event Procedures were introduced in Excel97. Earlier versions of Excel do not support events. An Event is an action initiated either by user action or by other VBA code.corporate training solutions excel

corporate training excel
Workbook Open Event
1. Open the Visual Basic Editor. (Shortcut- F11)
2. Double click on This Workbook in the Project Explorer.
3. Choose Workbook from the left drop-down list. Choose Open from the right drop-down list.
4. Add the following code line to the Workbook Open Event:
MsgBox “Welcome to VBA World!!!”
5. Save, close and reopen the Excel file.

training for excel basic and advanced

You will get Message Box Saying “Welcome to VBA World !!! “ at the very beginning once you will open the workbook.

training for excel macros

Example to create follow-up worksheet on regular basis
Private Sub Workbook_Open()
Range(“C2”).Activate
Do Until ActiveCell.Value = “”
If (ActiveCell.Value = Date) Or (ActiveCell.Value = Date + 1) Then
ActiveCell.Interior.ColorIndex = 3
ActiveCell.Font.Bold = True
ActiveCell.Offset(0, 1).Value = “Follow Me”
End If
ActiveCell.Offset(1, 0).Activate
Loop
End Sub
training for excel macros

Example: Worksheet Change Event
Code added to the Worksheet Change Event will be executed by Excel VBA when you change a cell on a worksheet.
corporate training in excel

1. Open the Visual Basic Editor.
2. Double click on a sheet (for example Sheet1) in the Project Explorer.
3. Choose Worksheet from the left drop-down list. Choose Change from the right drop-down list.
4. The Worksheet Change Event listens to all changes on Sheet1.
training for excel basic and advanced free download

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Value > 80 Then MsgBox “Goal Completed”
End Sub

14 thoughts on “VBA – Events

  1. Pingback: home
  2. Pingback:
  3. Pingback: additional info
  4. Pingback: Generic cialis
  5. Pingback: Viagra 5mg prix
  6. Pingback: Buy cialis
  7. Pingback: Cheap cialis
  8. Pingback: Nikola Moraca

Comments are closed.

Enjoy the tutorial? Please spread the word :)

Follow by Email
Facebook
Facebook
Google+2k
Google+
http://hirdeshbhardwaj.com/2017/10/16/training-companies-in-delhi-ncr
YouTube54
YouTube