+ Reply to Thread
Results 1 to 7 of 7

Macro to display a message box with row content

  1. #1
    Registered User
    Join Date
    04-14-2013
    Location
    Polska
    MS-Off Ver
    Excel 2007
    Posts
    11

    Macro to display a message box with row content

    Hi everybody,
    last year thanks to Nu2Java, I've made a macro for checking the number of the invitation on the guests list. If the invitation was on the list, the number was highlighted on yellow, or red if the same number was used twice.

    Sub MatchUserInput()
    Dim strSearchTerm
    Dim FirstMatch As Range
    Dim FirstAddress

    strSearchTerm = InputBox("Please enter the invitation number to find", "Warsaw 2014")

    If strSearchTerm <> "" Then
    Set FirstMatch = ActiveSheet.Cells.Find(strSearchTerm, LookAt:=xlWhole)
    If FirstMatch Is Nothing Then
    MsgBox "That invitation could not be found"
    Else
    FirstAddress = FirstMatch.Address
    While Not FirstMatch Is Nothing
    If FirstMatch = FirstMatch Then
    If FirstMatch.Interior.Color = vbYellow Then
    FirstMatch.Interior.Color = vbRed
    MsgBox "Invitation already used!"
    Exit Sub
    End If
    End If

    FirstMatch.Interior.Color = vbYellow
    Set FirstMatch = ActiveSheet.Cells.FindNext(FirstMatch)
    If FirstMatch.Address = FirstAddress Then
    Set FirstMatch = Nothing
    End If
    Wend
    End If
    End If
    End Sub
    I would like to add a message box that display name and last name of highlighted invitation's number, and later after confirming starting the procedure from the begining.
    I'm trying to do it but I failed. Any suggestions?

  2. #2
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Macro to display a message box with row content

    Is the invitation numbers entered into the A column of the sheets?
    In which columns are the first and last name?

    If the purpose of the macro is to find or colour code duplicate invite numbers, why not just use the Find box or use conditional formatting on duplicates?
    Just asking
    Regards,
    Rudi

  3. #3
    Registered User
    Join Date
    04-14-2013
    Location
    Polska
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Macro to display a message box with row content

    Hi Rudi,
    Yes, the number of the invitation is in the A column, the name in the B column, the last name in C.
    The purposes of the macro are:
    1. to find the number of the invitation.
    2. to highlight founded number on yellow and display in the message box the name and last name (it is around 300 rows/guests) in order to check if it's the same like on the invitation. If is ok, start procedure with the next invitation.
    3. If sombeody is trying to use the same number of the invitation (barcode) to display information and highlight it on red.

    I hope it is clear

  4. #4
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Macro to display a message box with row content

    OK...

    See if this works for you...

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-14-2013
    Location
    Polska
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Macro to display a message box with row content

    Rudi,
    it works amazing! Thank you very much!

  6. #6
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: Macro to display a message box with row content

    Excellent...great to know

  7. #7
    Registered User
    Join Date
    04-08-2014
    Location
    hk
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Macro to display a message box with row content

    hi, if i would like to finish the searching, how can i close the message box?

+ 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. Display a message while a macro is running
    By vbace2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-26-2015, 09:13 AM
  2. [SOLVED] Worksheet change event code to display message box based on active cell offset content
    By Nitefox in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2014, 02:52 PM
  3. Macro message box based on cell content
    By ln2012 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-25-2013, 11:51 AM
  4. Macro to display message every n minutes!
    By SER01 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-14-2009, 07:37 PM
  5. Display cell content in message box.
    By ledzepe in forum Excel General
    Replies: 1
    Last Post: 12-01-2006, 11:53 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