+ Reply to Thread
Results 1 to 13 of 13

How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

  1. #1
    Registered User
    Join Date
    11-07-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    54

    How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    Hello,

    Excel File: ExcelHelp.xlsm

    I am having a problem with searching values and trying to keep sheet1 Output active only

    For example: End user would only stay in Sheet1 Output. When end user do any search (this shows the following sheets gets switch from Sheet1 OUTPUT to Sheet2 DATA while doing a search ).

    Is there a way to avoid the sheet switch


    here is sample list of my data
    Data.PNG

    CODE:

    Please Login or Register  to view this content.
    Last edited by khhoa; 11-14-2014 at 08:02 PM. Reason: SOLVED

  2. #2
    Registered User
    Join Date
    11-07-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    54

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    please help thanks.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    Please post your spreadsheet.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    Please post your spreadsheet.

    Private Sub CommandButton3_Click()
    UserForm2.Show
    UserForm1.Hide
    End Sub

    Private Sub ListBox1_Click()

    Range("C5:C26").Select
    Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
    :=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
    False, SearchFormat:=False).Activate
    CR = Left(ListBox1.Value, InStr(Trim(ListBox1.Value), " ") - 1) * 1
    Sheets("Output").Range("B8").Value = Sheets("Data").Range("B" & CR).Value
    Sheets("Output").Range("B9").Value = Sheets("Data").Range("C" & CR).Value
    Sheets("Output").Range("B10").Value = Sheets("Data").Range("D" & CR).Value
    Sheets("Output").Range("B11").Value = Sheets("Data").Range("E" & CR).Value & ", " & Sheets("Data").Range("F" & CR).Value & " " & Sheets("Data").Range("G" & CR).Value
    ListBox1.Visible = False

    Unload Me
    End Sub

    Private Sub TextBox1_Change()

    If Len(TextBox1.Text) < 3 Then Exit Sub

    Sheets("Data").Select
    LR = Range("A95536").End(xlUp).Row

    Set rngLook = Range(Cells(1, 2), Cells(LR, 1))

    strValueToPick = TextBox1.Text

    On Error Resume Next

    'Find NAME IN COLUMN A
    With rngLook
    Set rngFind = .Find(strValueToPick, .Cells(1, 2), LookIn:=xlFormulas, LookAt:=xlWhole)
    If Not rngFind Is Nothing Then
    strFirstAddress = rngFind.Address
    Set rngPicked = rngFind
    Do
    Set rngPicked = Union(rngPicked, rngFind)
    Set rngFind = .FindNext(rngFind)
    Loop While Not rngFind Is Nothing And rngFind.Address <> strFirstAddress
    End If
    End With

    If strFirstAddress = "" Then Exit Sub
    If Not rngPicked Is Nothing Then
    rngPicked.Select
    End If

    ListBox1.Clear

    For Each c In Selection

    ListBox1.AddItem Cells(c.Row, 1).Row & " " & Cells(c.Row, 2).Value & " " & Cells(c.Row, 3).Value & " " & Cells(c.Row, 4).Value & " " & Cells(c.Row, 5).Value & " " & Cells(c.Row, 6).Value & " " & Cells(c.Row, 7).Value

    10 Next c
    If ListBox1.ListCount = 1 Then ListBox1_Click

    Changeflag = 0
    End Sub

  5. #5
    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,461

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    Untested, but you'd do something like this to avoid selecting the sheet(s)

    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


  6. #6
    Registered User
    Join Date
    11-07-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    54

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    Quote Originally Posted by mehmetcik View Post
    Please post your spreadsheet.
    ExcelHelp.xlsm

    Please look at attached document, when searching the sheets still swap over.


    Quote Originally Posted by TMS View Post
    Untested, but you'd do something like this to avoid selecting the sheet(s)
    Yea the sheets still swap with that code.
    Last edited by khhoa; 11-14-2014 at 05:19 PM.

  7. #7
    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,461

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    Please Login or Register  to view this content.

    Regards, TMS

  8. #8
    Registered User
    Join Date
    11-07-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    54

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    While on Output sheet, when I input the title input 1011, the results do not display only the #3 which is the row number

    but

    when I am on data sheet and RUN the userform under the Microsoft VBA, I would be able to see the data.

    In the end it does not work.
    Last edited by khhoa; 11-14-2014 at 05:13 PM.

  9. #9
    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,461

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    Please don't quote whole posts. It is unnecessary and just clutters the thread up.

    Unfortunately, I don't know how your process works. How you start it, what data you enter into what boxes, what buttons you click, and what output you expect to get. I have given you two examples of avoiding selecting worksheets and cells. You need to apply that technique wherever you select sheets and cells and make sure that the code refers to the worksheet of interest.

    Regards, TMS

  10. #10
    Registered User
    Join Date
    11-07-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    54

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    Sorry will remove quotes.

    User will open excel spreadsheet which process them to Sheet"Output".

    This has a option to select a button "SEARCH".

    The SEARCH will load USERFORM1 which the user can enter in a "TITLE"(a number for example: 1011)

    with any matching title 1011 will populate the listbox. ( but issue is when entering 101....... then 1 the sheets switch from OUTPUT to DATA "With the cell highlighted")

    that is the issue I have questioned.

  11. #11
    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,461

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    Please Login or Register  to view this content.

    See the updated example.


    Regards, TMS
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    11-07-2014
    Location
    California
    MS-Off Ver
    2010
    Posts
    54

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    Thank you tms!

    cheers!

  13. #13
    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,461

    Re: How to keep sheet1(output) active while searching sheet2(data) stop sheet switching

    You're welcome. Thanks for the rep.

+ 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. Replies: 6
    Last Post: 07-25-2013, 02:58 PM
  2. Finding Active Row in sheet1 from sheet2
    By mrall in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-03-2012, 11:26 AM
  3. Searching Sheet2 to find a match on Sheet1
    By ca1358 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-06-2011, 02:05 AM
  4. Input Sheet2 Output Sheet1
    By tomjoe in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-25-2008, 02:32 AM
  5. Formula in Sheet1, Output on Sheet2 Sheet 3...
    By uwhuskies in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-04-2007, 07:55 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