+ Reply to Thread
Results 1 to 5 of 5

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

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

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

    Hi, please help. I have a macro that I would like to run providing a particular cell "I2" contains the text string "net", even if there are other characters, eg cell says "nett" or "net total". If "net" does not exist, to stop the macro and a popup message saying "Incorrect Column", and nothing further happens.

    It would be great is somebody could help me with the code piece that I can insert into the existing macro.

    Thanks!

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,767

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

    Try this...

    Please Login or Register  to view this content.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #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?

    Please Login or Register  to view this content.
    Last edited by justindk; 01-15-2014 at 08:50 AM.

  4. #4
    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

    Apologies, I've amended my post.

  5. #5
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,767

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

    Thanks for adding the code tags

    Just delete the below line from your Post #3 code

    Please Login or Register  to view this content.
    Moderator's note: Added code tags with a sense of irony --6StringJazzer
    Last edited by 6StringJazzer; 01-15-2014 at 08:53 AM.

+ 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] 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