+ Reply to Thread
Results 1 to 3 of 3

MsgBox to Pop Up - When there is no data in a selected Range

  1. #1
    Registered User
    Join Date
    07-30-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    11

    MsgBox to Pop Up - When there is no data in a selected Range

    Hi,

    Introduction:
    I am working on creating a new Excel Sheet that is populated automatically with data from an external programme but need some help in regards on how to do something that seems so simple but I can not get my head around

    Issue:
    I would like to create a macro that would be initialised, when:
    1. A user opens up a Excel Document
    2. They Click a Button
    2. Which then will run a Macro that searches a column within a defined range.
    3. It will look for a designated value, in this case, that value is "X".
    4. Once the macro has located all cells within the designated range that contain the value "X", the rows which contain the value "X" are highlighted.

    Current Solution:
    Currently to do the above function, I have utilised the following Excel VBA code:

    Please Login or Register  to view this content.
    & The following Happens:
    1. A user opens up a Excel Document
    2. They Click a Button
    3. Which then will run a Macro that searches a column within a defined range.
    4. It will look for a designated value, in this case, that value is "X".
    5. Once the macro has located all cells within the designated range that contain the value "X", the rows which contain the value "X" are highlighted.
    6. However when there are no values with "X" within the designated range, the Macro fails.

    I think the reason why the Macro fails when there is no "X" value within the designated range is due to the " 'Highlight Rows: Select entire row of Catchphrase value " part of the code. However I have not able to think of an alternative code that I could write or could modify to make sure that the Macro does not fail when there are no "X" values. I have considered utilising a IF STATEMENT along with a MSGBOX but that did not seem to work.

    Other:
    I have attached an example worksheet of the VBA Code that I have shown above in working practice, below:
    Example - Find X Value Example.xlsm

    Thank you in advance.
    Sinalk

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,615

    Re: MsgBox to Pop Up - When there is no data in a selected Range

    Does this helps:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-30-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: MsgBox to Pop Up - When there is no data in a selected Range

    Hi zbor,

    That works a treat, I did not realise I was looking in the wrong part of the code.

    Thank you again, it was much appreciated.

    Kind Regards,
    -Sinalk

+ 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] Export caption of selected checkbox to msgbox
    By SoulPrisoner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-29-2013, 11:57 AM
  2. [SOLVED] MsgBox if data entered in range is not numeric
    By kbka in forum Excel General
    Replies: 5
    Last Post: 11-19-2012, 08:35 AM
  3. [SOLVED] If Row 9 is not selected, then msgbox
    By VBA FTW in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-11-2012, 01:36 PM
  4. Msgbox when worksheet is selected
    By obrien2010 in forum Excel General
    Replies: 2
    Last Post: 08-24-2010, 11:53 AM
  5. Add data to range using MsgBox
    By dmspen in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-28-2008, 12: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