+ Reply to Thread
Results 1 to 4 of 4

VBA Code to stop macro going any further if certain cells have data in them

  1. #1
    Registered User
    Join Date
    10-21-2018
    Location
    Atherton, Australia
    MS-Off Ver
    Office 365
    Posts
    6

    VBA Code to stop macro going any further if certain cells have data in them

    Hi,
    I am fairly new to Macro's and I have recently put together a Jobsheet spreadsheet for my client who is an Electrical Contractor.

    So sheet 1 is the Job sheet form
    Sheet 2 is the existing Customers database
    Sheet 3 is the products list to be added to the form.

    It is working fairly well except when it comes to preventing a double up by hitting the wrong macro button when selecting an existing customer from a drop-down list.

    I have 2 Macro buttons side by side -
    1 is to populate the rest of the customer's details into the top of the Job once you have selected the customer's name.
    2nd one is to add a new customer by filling in the JobSheet fields and then clicking on the Save Macro button.

    For the 2nd Macro button that saves a new customer to the list, I need VBA coding to produce a pop up asking say " Are you sure you want to Save this information as a new Customer " then supply a drop-down list with "yes/No" options
    if "Yes" then a 2nd message pops up " Are all relevant customer details fields filled in " then supply a drop-down list with "yes/No" options
    if "Yes" then the new customer is inserted into the Customers Table.
    If No then the macro ends.

    Any Help greatly appreciated
    Last edited by Stevec63; 10-21-2018 at 05:53 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,421

    Re: VBA Code to stop macro going any further if certain cells have data in them

    Use Exit Sub
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    10-21-2018
    Location
    Atherton, Australia
    MS-Off Ver
    Office 365
    Posts
    6

    Re: VBA Code to stop macro going any further if certain cells have data in them

    Thanks TMS for the prompt reply.

    I realized that the title of my post was all wrong so I have raised another one to suit my application.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,421

    Re: VBA Code to stop macro going any further if certain cells have data in them

    You need to provide a link to the other post and mark this one closed.

+ 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. [SOLVED] Stop code from running when a range of cells are empty.
    By Neuk in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-22-2018, 04:09 PM
  2. [SOLVED] Macro Code Will Not Stop Saving In My Module
    By TBM in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-12-2016, 01:22 PM
  3. Help in macro code to stop code running for certain time
    By ExcelFailure in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-05-2015, 02:35 AM
  4. adapt VBA code to stop and alert if any cells are blank
    By yachrishere in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-01-2014, 06:52 AM
  5. [SOLVED] How to stop a code from running using an another code/macro
    By danjim02 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2013, 08:21 AM
  6. [SOLVED] VBA code to stop the macro
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2013, 02:17 PM
  7. Code to stop a worksheet_selectionchange macro running
    By hriggs in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-17-2009, 06:23 AM

Tags for this Thread

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