+ Reply to Thread
Results 1 to 9 of 9

Instead of Msgbox display results in a column

  1. #1
    Registered User
    Join Date
    02-11-2015
    Location
    Berlin
    MS-Off Ver
    2013
    Posts
    4

    Instead of Msgbox display results in a column

    Hello everybody,

    First, love Excel forums, have helped me a lot in the last 2 years. Love you!

    Now i have a question where i cannot find an answer:

    I found a Macro in the Internet which helps me: It displays all cells that have a given value in it.

    BUT it displays me the result in a Msgbox!

    i would like to have it in Sheetxyz in column A.

    Here is the formula:

    Sub WBSearch()
    Dim ws As Worksheet
    theWord = InputBox("Enter text to search", "Search Criteria")
    If theWord = "" Then
    Exit Sub
    End If
    For Each ws In ActiveWorkbook.Worksheets
    ws.Select
    For Each cell In ActiveSheet.UsedRange
    If InStr(1, UCase(cell.Value), UCase(theWord)) Then
    wIndex = wIndex & Chr(10) & ActiveSheet.Name & " - " & _
    cell.Address(0, 0)
    End If
    Next
    Next
    If wIndex = "" Then
    MsgBox UCase(theWord) & " was not located in this workbook.", _
    vbOKOnly, "Not Found"
    Else
    MsgBox wIndex, vbOKOnly, UCase(theWord) & " was found in:"
    End If
    End Sub


    Thanks a lot in advance

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Instead of Msgbox display results in a column

    Please put your code in
    Please Login or Register  to view this content.

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

    Re: Instead of Msgbox display results in a column

    Welcome to the Forum. Please review the Forum Rules when posting and use code tags for your code.

    http://www.excelforum.com/forum-rule...rum-rules.html

    Try:

    Please Login or Register  to view this content.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,528

    Re: Instead of Msgbox display results in a column

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Registered User
    Join Date
    02-11-2015
    Location
    Berlin
    MS-Off Ver
    2013
    Posts
    4

    Re: Instead of Msgbox display results in a column

    Thank you John and Thank you TMS

    Although i have a small issue with your formulas, thank you very much for giving me such a quick answer!

    John, when I try your macro, VBA marks me the second "Next" at the end and writes "Next without For". I have no VBA knowledge, so no clou.

    TMS, your formula works fine, there is just 2 small thing i would like to change:

    1)Is it possible to display each result in a single cell instead of all results in one cell?
    2) Is it possible not to dsiplay the actual cells, but their content. If for example i search for "Lauren" it doesnt tell me "Cell A2" but gives me "Laurenzino.

    Thanlk you very much!!!!

    Laurenzino

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

    Re: Instead of Msgbox display results in a column

    My mistake delete one of the Next's.

  7. #7
    Registered User
    Join Date
    02-11-2015
    Location
    Berlin
    MS-Off Ver
    2013
    Posts
    4

    Re: Instead of Msgbox display results in a column

    Then it tells me:

    "Block If without End if"

  8. #8
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Instead of Msgbox display results in a column

    This will output the cell value instead of the cell address, as requested.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-11-2015
    Location
    Berlin
    MS-Off Ver
    2013
    Posts
    4

    Re: Instead of Msgbox display results in a column

    Thanks a lot Wallrus egg man and everybody else!

+ 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. Multi column ComboBox - How to Display the results of second column?
    By nreyes2000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-13-2014, 04:28 PM
  2. [SOLVED] Msgbox to display multiple results if they occur
    By Masun in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-05-2013, 08:11 AM
  3. [SOLVED] Count if, display results in msgbox
    By j9070749 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-24-2012, 12:22 AM
  4. Display Row & column number in MsgBox
    By Astroboy142 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-02-2009, 07:27 PM
  5. [SOLVED] VB evaluate a value in a table's column and display msgbox
    By AusTexRich in forum Excel General
    Replies: 8
    Last Post: 10-10-2005, 06:05 PM

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