Copy Formula result as value into find

SeliM

New Member
Joined
Aug 10, 2023
Messages
45
Office Version
  1. 365
Platform
  1. Windows
Good morning
Thank you for reading my enquiry
Background: I'm working with a local government to simplify their procurement system. The key component is an off the shelf proprietary system that after a range of activities produces an excel workbook with an assessment output that can run to 300 or so lines.

The work undertaken is to produce a template for approval signatures based on the assessment results.
The work relies on perfect match of assessment criterions between the proprietary output and the template workbook.
I have set up a Match WS to test if the criterions match if not the wording that does not match is displayed.
I have a macro to find the criteria in question however the VBA text uses the actual words of the criteria - hence is static. I have tried to find a way to not have static wording but rather a cell reference without success.
Could you advise on script that selects a cell, copies value and uses find in another ws?

Many thanks

Mel
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Hi Mel

You can retrieve the value from a cell by using the .Value property, like this for example. The message box will display whatever you put in A1.

VBA Code:
Sub Criteria()
    Dim crit_word As String
    crit_word = Range("A1").Value
    MsgBox "Criteria wording is """ & crit_word & """"
End Sub
 
Upvote 0
Many Thanks,
is there a means by which VBA can refer to the contents of a cell on another WS and use in the find facility to find that value in another WS?
The static script looks like:
Cells.Find(What:="Availability and qualifications of key personnel ", After _
:=ActiveCell, LookIn:=xlFormulas2, LookAt:=xlPart, SearchOrder:=xlByRows _
, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False). _
Activate

Is it possible to change "Availability and qualifications of key personnel " to a cell reference such as 'Text Match'!$E$4 and find content of $E$4 in WS 'Weighting Table"?

Thanks
Mel
 
Upvote 0
Something like this:

VBA Code:
Sub FindMe()
    Dim SearchString As String, CellsFound As String, FirstHit As String
    Dim c As Range
    SearchString = Worksheets("Text Match").Range("E4").Value
    Application.FindFormat.Clear
    
    With Worksheets("Weighting Table")
        Set c = .Cells.Find(What:=SearchString, After _
            :=ActiveCell, LookIn:=xlFormulas2, LookAt:=xlPart, SearchOrder:=xlByRows _
        , SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
        If Not c Is Nothing Then
            FirstHit = c.Address
            Do
                CellsFound = CellsFound & c.Address & "; "
                Set c = .Cells.FindNext(After:=c)
            Loop Until FirstHit = c.Address
        End If
    End With
    MsgBox "String found at " & CellsFound
End Sub
 
Upvote 0
Is it possible to change "Availability and qualifications of key personnel " to a cell reference such as 'Text Match'!$E$4 and find content of $E$4 in WS 'Weighting Table"?
The code I just provided looks for the value given in 'Text Match'!$E$4 and finds the cell address of anywhere that value occurs on sheet 'Weighting Table'
If you just want to compare values between cells then find is probably not the best way to go about it. For example, if you wanted to compare all the values in the two sheets over the range B3:S20 then I'd use different code to do that, but we would need more details about what you're comparing.
 
Upvote 0

Forum statistics

Threads
1,222,622
Messages
6,167,126
Members
452,098
Latest member
xel003

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