+ Reply to Thread
Results 1 to 3 of 3

Msg Box to clear content error

Hybrid View

SARC777 Msg Box to clear content error 08-16-2010, 03:19 AM
DonkeyOte Re: Msg Box to clear content... 08-16-2010, 03:21 AM
SARC777 Re: Msg Box to clear content... 08-16-2010, 03:55 AM
  1. #1
    Registered User
    Join Date
    08-12-2010
    Location
    Nuwara Eliya, Sri Lanka
    MS-Off Ver
    Excel 2007
    Posts
    54

    Msg Box to clear content error

    I cant get this code to work.. can someone help me..

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    With Worksheets("Formulation")
    If .Range("d3") <> "" _
    Or .Range("d5") <> "" _
    Or .Range("d6") <> "" Then
    MsgBox ("Please delete content in Formula No, Batch No & QTY")
    End If
    
    End Sub
    Last edited by SARC777; 08-16-2010 at 03:56 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Msg Box to clear content error

    You're missing the End With post End If ... I suspect you also want to add a Cancel = True post MsgBox but prior to the End If.

  3. #3
    Registered User
    Join Date
    08-12-2010
    Location
    Nuwara Eliya, Sri Lanka
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: Msg Box to clear content error

    Thanks.. It works now after the modification.. Thanks alot..

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1