Results 1 to 10 of 10

VBA to show error message

Threaded View

  1. #9
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: VBA to show error message

    Hello rakul_rakul and sintek,

    Please try;

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        
      Application.EnableEvents = False
        
        If Not Intersect(Target, Range("A:A")) Is Nothing Then
         Call Macro
          Else: Target.Offset(-1, 8).ClearContents
        End If
        
      Application.EnableEvents = True
      
    End Sub
    Option Explicit
    
    Sub Macro()
    Dim i As Long
    Application.ScreenUpdating = False
    With Sheet1
        For i = 3 To .Cells(Rows.Count, "A").End(xlUp).Row
            If .Cells(i, 1).Offset(-1, 8) = "" Then
                 .Cells(i, 1) = ""
                MsgBox "Please enter a comment in previous row Column I"
                .Cells(i, 1).Offset(-1, 8).Select
                'Exit Sub
            End If
        Next i
    End With
    Application.ScreenUpdating = True
    End Sub
    See attached sample Workbook.

    Regards.
    Attached Files Attached Files
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 12-08-2016, 06:43 PM
  2. How to show an error message with incorrect date format
    By ramatthews in forum Excel General
    Replies: 5
    Last Post: 05-11-2015, 08:52 AM
  3. [SOLVED] On error, ignore error but show message box
    By chin67326 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-18-2015, 07:54 PM
  4. If Value Exists on another worksheet, show error message
    By BreatGritain in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-28-2014, 12:39 PM
  5. Simple code required to show message box on error
    By caabdul in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-24-2014, 04:08 PM
  6. Stop a Macro if Criteria not met and Show Error Message
    By m3hool in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-17-2013, 10:12 AM
  7. Run the Macro if cell value is YES, else show error message.
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2008, 02:03 AM

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