Results 1 to 5 of 5

If cell contains text string then run macro, otherwise stop macro and popup message

Threaded View

  1. #3
    Registered User
    Join Date
    01-13-2014
    Location
    South Africa
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: If cell contains text string then run macro, otherwise stop macro and popup message

    Hi, thanks SixthSense.

    I realise I'm being thick here but I'm not a coder and this isn't working for me. Most of my macros are 'recorded'. Below is how I've inserted this into my code, please can you tell me where I'm going wrong?

    Sub BOQ_I()
    '
    ' BOQ_I Macro
    '
        If InStr(1, Range("I2").Value, "net", vbTextCompare) = 0 Then
        MsgBox "Incorrect column selected for Net data, verify correct data source and try again", vbInformation, "Incorrect Column"
        Exit Sub
    End If
        Columns("B:H").Select
        Application.Run "PERSONAL.XLSB!FormatImportTab"
        Sheets("Master").Select
        Range("A2").Select
        Application.Run "PERSONAL.XLSB!Master_I"
        ActiveWorkbook.Save
    End Sub
    Last edited by justindk; 01-15-2014 at 08:50 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] If cell is empty in a variable range, stop macro and return error message
    By Andrei Kononenko in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-22-2019, 02:19 PM
  2. How to stop PasteSpecial popup message
    By gorgon777 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-17-2013, 05:12 PM
  3. Macro For Popup Message
    By manian in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2011, 11:45 AM
  4. Macro for Message Popup
    By bngguy in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-27-2010, 02:24 PM
  5. Make macro stop and give message box.
    By Hjahren in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-29-2010, 08:04 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