Partial Text Lookup

wrightyrx7

Well-known Member
Joined
Sep 15, 2011
Messages
994
Hi all just been watchin the new videos on youtube and seen the partial text lookup video that may come in handy at work.

Problem is its on multiple Worksheets. Let me explain....

What i do I log forms onto seperate worksheets as they come into the office.
Columns consist of:-
-Employee Number
-First Name
-Surname
-Date Recieved
-Form Type
-Date Completed
-Completed By

So i log these forms and when someone completes a form they fill in the -Date Completed & -Completed by column.

So as you might of guessed each worksheet after a while is getting longer and longer. And when an employee contacts me to see where their forms are upto i have to flick through the worksheets using CTRL+F to see if they are on that worksheet. Which is a pain in the backside.

I was wondering if anyone could help me put something on a blank worksheet to seach by employee number and it bring back all the results no matter what worksheet the information is on?


Hope i have explained it clear enough, please ask if you need any more information.

Thanks in advance

Chris
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Try this on a copy of your data.
Code:
Private Function SheetExists(Sheetname As String) As Boolean
    ' Returns TRUE if a sheet exists in the active workbook
    Dim x As Worksheet
        On Error Resume Next
            Set x = ActiveWorkbook.Sheets(Sheetname)
                If Err = 0 Then SheetExists = True _
                Else SheetExists = False
End Function

Sub FindAllSheets()
    Dim Found As Range, ws As Worksheet, LookFor As Variant
        LookFor = InputBox("Enter value to find")
            
            If LookFor = "" Then Exit Sub
            
            '   Clear or Add a Results sheet
            If SheetExists("Search Results") Then
              Sheets("Search Results").Activate
              Range("A2").Select
              Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
              Selection.ClearContents
            Else
                Sheets.Add After:=Sheets(Sheets.count)
                ActiveSheet.Name = "Search Results"
            End If
            
            For Each ws In ActiveWorkbook.Worksheets
                If ws.Name <> "Search Results" Then
                     Set Found = ws.Cells.Find(What:=LookFor)
                     If Found Is Nothing Then
                         Range("D5").Select
                     Else
                         Found.EntireRow.Copy Sheets("Search results").Cells(Rows.count, "A").End(xlUp).Offset(1)
                     End If
                End If
            Next ws
End Sub
 
Upvote 0
Forget that i figured it out.... WOW thats was quick and does exactly what i want! Your an absolute star!!

Thanks Again

ps. Will this work with Excel 2003? Thats what they have at work :(
 
Last edited:
Upvote 0
Press Alt & F11 together to open up the VBA window, on the left hand side of the window you will see a list that contains your workbook name. Right click your workbook name and select 'Insert' then 'Module' then paste my code into the large right hand section of the window. Click the big red cross int he top right hand corner of the screen to close the VBA window. Then select 'View' and 'Macros' and a window pops up with the name of the macro in it. Double click it and off you go.

HTH
Paul
 
Upvote 0
I assigned the macro to a image and it works like a gem. Its a real time saver.

I might be pushing my luck but is the a way that if a form had not been completed (has no values in the -Date Completed or -Compleded by) then font colour of that row is red?

Thank you
Chris
 
Upvote 0
Try something like this
Code:
    Dim LR As Long, i As Long
LR = Range("F" & Rows.count).End(xlUp).Row
For i = LR To 1 Step -1
    If Range("F" & i).Value = "" Or Range("G" & i).Value = "" Then Rows(i).Font.ColorIndex = 3
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,683
Members
452,937
Latest member
Bhg1984

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top