Results 1 to 4 of 4

Thread: Macro - Pasting cell contents into FIND Function

  1. #1
    New Member
    Join Date
    Sep 2019
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Macro - Pasting cell contents into FIND Function

    Hi there,

    Here is my dilemma, everyday I check the last entry in a column and cross reference it with data from another workbook to see if I need to add data to my original sheet.
    So when i recorded my macro, I thought i'd be able to copy the contents of my last entry and paste it into the find and replace window. (to find in the cross reference)
    The problem is it's using the data from when i recorded the macro instead of pasting the fresh data from the clipboard. I've highlighted it in red. I want my clipboard contents to be pasted in the red section. Is there a way to do that? Thanks

    Selection.End(xlDown).Select
    Selection.Copy
    Windows("blabla.xlsx").Activate
    Cells.Find(What:="303296", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False, SearchFormat:=False).Activate

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,123
    Post Thanks / Like
    Mentioned
    470 Post(s)
    Tagged
    47 Thread(s)

    Default Re: Macro - Pasting cell contents into FIND Function

    How about
    Code:
    Dim Rng As Range
    Set Rng = Selection.End(xlDown)
    
    Windows("blabla.xlsx").Activate
    Cells.Find(What:=Rng.Value, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
    :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
    False, SearchFormat:=False).Activate
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  3. #3
    New Member
    Join Date
    Sep 2019
    Posts
    5
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Macro - Pasting cell contents into FIND Function

    Works great, Thank you!

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,123
    Post Thanks / Like
    Mentioned
    470 Post(s)
    Tagged
    47 Thread(s)

    Default Re: Macro - Pasting cell contents into FIND Function

    You're welcome & thanks for the feedback
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •