PASTE WHATEVER IS COPIED INTO "FIND&REPLACE FUNCTION"

rapitorres

New Member
Joined
Oct 5, 2017
Messages
39
Office Version
  1. 2010
Platform
  1. Windows
HI,

I don't know if this is possible, but I wanted to automate searching a cell content to another sheet and changing its status
I've come to this macro build with ctrl+f

Selection.Copy
Application.CutCopyMode = False
Selection.Copy
Sheets("ORDER REPORT LAZADA").Select
Cells.Find(What:="", After:=ActiveCell, LookIn:= _
xlFormulas2, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Selection.End(xlToRight).Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "PAID"
Sheets("SOA ALL ONLINE").Select

now this returns me no results. maybe because I leave the Cells.Find(What:="", After:=ActiveCell, LookIn: blank
thinking it will paste whatever a copied.


any suggestion will be greatly appreciated :)
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I always like it when users tell me in words with specific details what their attempting to achieve.
Do not show me a script that does not work and expect me to understand what the ultimate goal is.
And be very specific with sheet names and such. Then I hope I can help you
 
Upvote 0
Rather then coloring code, they have this wonderful thing called "code tags". You might have seen the result in some other posts.
Some sites actually require you to use them before you are allowed to continue in your post.
Now if you are wondering how to use them, I have this little picture for you.

Use Code Tags MrExcel.JPG
 
Upvote 0
See if this gives you any ideas:
It is relying on the Activecell value. Copy doesn't add any value. You still need a way to trigger the macro eg a shortcut key or button or something on your QAT (Quick Access Toolbar)

VBA Code:
Sub TestFind()

    Dim mainSht As Worksheet, findSht As Worksheet
    Dim critCell As Range, findCell As Range
    
    Set mainSht = Worksheets("SOA ALL ONLINE")
    Set findSht = Worksheets("ORDER REPORT LAZADA")

    Set critCell = ActiveCell
    
    Set findCell = findSht.Cells.Find(What:=critCell.Value, After:=ActiveCell, LookIn:= _
        xlFormulas2, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False)
        
    If Not findCell Is Nothing Then
        findCell.End(xlToRight).Value = "PAID"  ' <--- Specify a column don't rely on this
        Set findCell = Nothing
    End If

End Sub
 
Upvote 0
Solution
Rather then coloring code, they have this wonderful thing called "code tags". You might have seen the result in some other posts.
Some sites actually require you to use them before you are allowed to continue in your post.
Now if you are wondering how to use them, I have this little picture for you.

View attachment 66660
yup will do it nextime.
 
Upvote 0
See if this gives you any ideas:
It is relying on the Activecell value. Copy doesn't add any value. You still need a way to trigger the macro eg a shortcut key or button or something on your QAT (Quick Access Toolbar)

VBA Code:
Sub TestFind()

    Dim mainSht As Worksheet, findSht As Worksheet
    Dim critCell As Range, findCell As Range
   
    Set mainSht = Worksheets("SOA ALL ONLINE")
    Set findSht = Worksheets("ORDER REPORT LAZADA")

    Set critCell = ActiveCell
   
    Set findCell = findSht.Cells.Find(What:=critCell.Value, After:=ActiveCell, LookIn:= _
        xlFormulas2, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False)
       
    If Not findCell Is Nothing Then
        findCell.End(xlToRight).Value = "PAID"  ' <--- Specify a column don't rely on this
        Set findCell = Nothing
    End If

End Sub
works like a charm! now let me study this script and how did that happen.
 
Upvote 0
Thanks for letting us know. Glad we could help.
Feel free to come back to us if you need any part explained.
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

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