• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

how to write two vba codes for one sheet

MR.Mewada

New Member
Code:
1
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Target.Column = 2 Then
confirm = MsgBox("Do you wish to confirm entry of this data?", vbYesNo, "confirm Entry")
Select Case confirm
Case Is = vbYes
Case Is = vbNo
Application.Undo
End Select
End If
Application.EnableEvents = True
End Sub
2
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim blnEmptyCell As Boolean
blnEmptyCell = False
If Sheets("Sheet1").Range("B13") = "" Then blnEmptyCell = True
If Sheets("Sheet1").Range("B14") = "" Then blnEmptyCell = True
If blnEmptyCell = True Then
  MsgBox "One or more of the required fields is blank.  Please complete all required fields."
  Cancel = True
End If
End Sub
 
Last edited by a moderator:
Hello MR.Mewada,

In the future, please use the [code] and [/code] tags to post your code properly. Second, you'll also need to explain what your question is. Simply posting code does not let us know what your question is.
 
Back
Top