Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Internet & the Web (https://www.askmehelpdesk.com/forumdisplay.php?f=177)
-   -   Code alteration help (https://www.askmehelpdesk.com/showthread.php?t=10743)

  • Jul 4, 2005, 06:34 AM
    traka
    Code alteration help
    I have done some extensive searches and have asked in expert forums for excel, but can't seem to get the right answer. So here goes.
    The code below is as close as I can find, but the situation is like this.

    Excel Workbook
    Sheet 1
    Sheet 2
    ----------------------
    Sheet 1 Cell A1
    Fixed value ( number or text )
    Fixed value means it is always in A1, but the actual value constaly changes.
    When it changes, the new value will still be in A1
    -------
    Sheet 2
    will have the same value as in A1, but anywhere within that sheet.
    I need to find the value of A1 Sheet 1, in Sheet 2.
    The rest of the code can take care of the rest because copies a section from the found location in Sheet 2.
    Let's say it finds the value of A1 in BB 467 of Sheet 2.
    From there the rest of the code will do a set range select and copy the data.
    That's OK, I can deal with that part, but it's finding it with macro code.
    --------
    The code I was shown, one has to type in the contents of A1.
    It is not required to type in, it's already there. ( but constantly changes)
    But it looks like this:
    ---------------

    Sub Find_First()

    Dim FindString As String
    Dim Rng As Range
    FindString = InputBox("Enter a Search value")

    If Trim(FindString) <> "" Then
    Set Rng = Range("A:A").find(What:=FindString, _
    After:=Range("A" & Rows.Count), _
    LookIn:=xlFormulas, _
    LookAt:=xlWhole, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False)
    If Not Rng Is Nothing Then
    Application.Goto Rng, True
    Else
    MsgBox "Nothing found"
    End If
    End If
    End Sub


    ---------
    Where it has :
    FindString = InputBox("
    End If
    End If
    End Sub


    ---------
    Where it has :
    FindString = InputBox(")
    I can't seem to find the right syntax so the "Search Value" is whatever is in Sheet 1 A1 then go to Sheet 2 and see if it is there.
    Much appreciated.

  • All times are GMT -7. The time now is 09:42 AM.