+ Reply to Thread
Results 1 to 3 of 3

I want a pop-up message rather than the macro debug message, when my macro can't run

  1. #1
    Registered User
    Join Date
    08-10-2015
    Location
    Wellington, New Zealand
    MS-Off Ver
    2013
    Posts
    2

    I want a pop-up message rather than the macro debug message, when my macro can't run

    Hi All,

    First time posting so hopefully this makes sense:

    I have created an excel form that will be used by a number of people

    Within the form users can delete rows by clicking on a "delete rows" button. However I only want users to delete specific rows, as such I have locked some of the cells and protected the worksheet so that certain rows cannot be deleted.

    The rather simple delete rows macro:

    Public Sub Delete()
    With ActiveSheet.Buttons(Application.Caller).TopLeftCell.EntireRow.Select
    ActiveCell.Offset(2).EntireRow.Delete
    End With
    End Sub


    As expected when the user tries to delete too many rows the macro can't run as the cells are locked and the debug pane pops up.

    Instead of the debug pane popping up, I would like a message box to pop up saying "you cannot delete any more rows"

    Thanks in advance for your help and please let me know if any further info is needed.

  2. #2
    Valued Forum Contributor quekbc's Avatar
    Join Date
    01-18-2010
    Location
    Sydney, Australia
    MS-Off Ver
    2010, 2013, 2016
    Posts
    1,149

    Re: I want a pop-up message rather than the macro debug message, when my macro can't run

    You can use the On Error statement to trap/handle errors. For example:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-10-2015
    Location
    Wellington, New Zealand
    MS-Off Ver
    2013
    Posts
    2

    Re: I want a pop-up message rather than the macro debug message, when my macro can't run

    That works perfectly, thank you for your help and the very quick response.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. If user doesn't open file...avoid from the Debug message coming up
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-12-2015, 02:18 PM
  2. how to debug this error message
    By vimalanathk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-01-2014, 01:01 PM
  3. [SOLVED] Error message when trying to record a macro - No Personal Macro Workbook
    By KimC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-14-2014, 06:56 PM
  4. If cell contains text string then run macro, otherwise stop macro and popup message
    By justindk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-15-2014, 08:20 AM
  5. Macro Problem with VBA need Help (copy past cells with macro and message box)
    By Nissort in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-25-2013, 12:17 PM
  6. message box - macro - message box
    By stevesunfold in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-15-2008, 12:51 PM
  7. Macro Security Message when opening file, but I've removed the macro
    By jwalitt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2007, 12:14 PM

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