+ Reply to Thread
Results 1 to 7 of 7

Pop up box depending on criteria entered across multiple columns

  1. #1
    Registered User
    Join Date
    03-10-2016
    Location
    UK
    MS-Off Ver
    2007
    Posts
    3

    Pop up box depending on criteria entered across multiple columns

    Good morning,

    I have a spreadsheet where I need a pop-up box to appear if the value 'x' is entered. However, I did a different pop-up box for each column.


    I can get a pop up to appear in one one area, but I don't know how to duplicate for the others (do I copy & past the same code in full, or just bits?). Apologies but this is my first time using VBA so all a bit confusing.

    Example below:

    If 'x' is entered in Columns A1:B35, text box says '"column one information"
    If 'x' is entered in Column C1:D35, text box says "column two information" etc etc etc

    Spreadsheet VBA.JPG

    This is the code I am currently using

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim Rg As Range
    On Error Resume Next
    Set Rg = Application.Intersect(Target, Range("A1:B35"))
    If Not Rg Is Nothing Then
    If Target.Value = "x" Then
    MsgBox "text to show in message box"
    Exit Sub
    End If
    End If
    End Sub
    Private Sub Worksheet_selectionChange(ByVal Target As Range)
    Dim xCell As Range, Rg As Range
    On Error Resume Next
    Set Rg = Application.Intersect(Target, Range("A1:B35"))
    If Not Rg Is Nothing Then
    For Each xCell In Rg
    If xCell.Value = "x" Then
    MsgBox "text to show in message box”
    Exit Sub
    End If

  2. #2
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    640

    Re: Pop up box depending on criteria entered across multiple columns

    Does it need to be VBA?

    A formula above/below each column will let you know if this value is present within the range?

    =Countif(A1:B35,x)

    This would be an easy substitute

  3. #3
    Valued Forum Contributor Kamboj's Avatar
    Join Date
    09-25-2014
    Location
    India
    MS-Off Ver
    2003 - 2010
    Posts
    430

    Re: Pop up box depending on criteria entered across multiple columns

    you can use:-

    Please Login or Register  to view this content.
    Kamboj
    _________________________________________________________________________________
    Mark the thread as SOLVED if my answer satisfy you.

  4. #4
    Registered User
    Join Date
    03-10-2016
    Location
    UK
    MS-Off Ver
    2007
    Posts
    3

    Re: Pop up box depending on criteria entered across multiple columns

    Thank you,

    To clarify,

    Id on't need to know if the value is present, but if it is I need a pop to provide some additional information.
    I can get the code about to cover all the columns with one set pop up box, but what I need is a pop with different text in on each

    e.g. if 'x' is is column A1:B25 the pop gives one set of information (pop up 1)
    if 'x' is in column C1:D35 the pop up says different information (pop up 2)

    I can set the different text to work on any individual column, but I can't get them to work all together
    Attached Images Attached Images

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Pop up box depending on criteria entered across multiple columns

    See if this can be useful for your purpose. Refer to Tab "Test".
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    03-10-2016
    Location
    UK
    MS-Off Ver
    2007
    Posts
    3

    Re: Pop up box depending on criteria entered across multiple columns

    Perfect, just what I needed.

    Thank you so much for your help

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Pop up box depending on criteria entered across multiple columns

    You're welcome. Glad to help out and thanks for the feedback. If the issue is resolved, please mark this thread as SOLVED. Click Thread Tools above your first post, select "Mark your thread as Solved". Or click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes.

+ 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. Sum cell across multiple sheets depending on multiple criteria
    By ExcelHelp79 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-19-2016, 10:16 PM
  2. Hide rows depending on a criteria entered in a dialogue box.
    By realrookie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-01-2016, 07:12 AM
  3. Extract Values Depending on Multiple Criteria
    By jesito in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 06-19-2015, 09:20 PM
  4. Array of columns, SUMIF a particular column, depending on a certain criteria
    By kiwihunter in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-24-2014, 10:04 AM
  5. Combining multiple rows from 2 columns into sorted columns depending on 1st columns value
    By Dexamphetamine in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-11-2013, 10:00 AM
  6. Replies: 1
    Last Post: 05-15-2013, 09:51 PM
  7. [SOLVED] Need help to get info from different columns & rows depending on criteria
    By abqr1 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-14-2012, 01:44 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