+ Reply to Thread
Results 1 to 8 of 8

Stop a running macro

Hybrid View

  1. #1
    Registered User
    Join Date
    09-15-2008
    Location
    Montana
    Posts
    11
    This was my first attemp at writing code. These lines are only for the first value. I have 20 additional InputBox statements. The reason for a method to stop the macro is many individuals running the macro and getting interrupted while inputing data.

    Sub Fill01()
    Worksheets("SINGLE PHASE CONSTRUCTION").Activate
        Dim UserEntry As String
        UserEntry = InputBox("What is the W/O #?", "INPUT W/O")
        If UserEntry <> "" Then Range("B2").Value = UserEntry
    END SUB

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Test UserEntry for "Quit" or something similar.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try this

    Option Explicit
    
    Sub Fill01()
        'Worksheets("SINGLE PHASE CONSTRUCTION").Activate
        Dim UserEntry As String
        UserEntry = InputBox("What is the W/O #?", "INPUT W/O")
        Select Case UserEntry
            Case "": Exit Sub
            Case Else: Range("B2").Value = UserEntry
        End Select
    End Sub
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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. Use Event Procedure and OnTime to Stop a Macro
    By Protiusmime in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-26-2008, 07:46 PM
  2. Running Excel 4.0 Macro in Excel 2007.
    By CdSlc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-26-2008, 10:46 AM
  3. Error Saving after running Macro
    By millen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-05-2007, 09:14 AM
  4. Macro won't stop running!
    By wizard007 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-05-2007, 06:09 AM
  5. automatically running a macro by selecting a worksheet
    By aralebd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-07-2006, 05:43 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