Modification in Recorded Macro

D

Dhimant

Hi,
I m trying below code
Sub Macro1()
Application.Goto Reference:="Sheet1!RC"
Selection.Copy
Application.Goto Reference:="'Sheet2'!RC"
Cells.Find(What:="NOV08987", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Application.CutCopyMode = False
End Sub

but at "NOV08987" I want to use sheet1!A1 Kindly
Thanks in advance for any tip or hint.
 
F

FSt1

hi
if i understand, you want to replace the result of the find on sheet 1 with
the value of RC on sheet1. if so...

Dim r As String
r = Sheets("sheet1").Range("A1").Value
Sheets("sheet2").Activate
Cells.Find(What:="NOV08987", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

ActiveCell.Value = r

or....
do you want to use the value of sheet1 A1 as the search criteria.
Dim r As String
r = Sheets("sheet1").Range("A1").Value
Sheets("sheet2").Activate
Cells.Find(What:=r, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

post back if i got it all wrong.

Regards
FSt1
 
D

Don Guillett

This is modified to find the value in sheet1!a1 somewhere in sheet 2 withOUT
selections.
Probably needs more refinement to finish what you want after you have found
it


sub getdatafromsheet2()
what = Sheets("sheet1").Range("a1")

myvalue = Sheets("sheet2").Cells.Find(what, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False) ' .address

MsgBox myvalue
End Sub
 
D

Dhimant

thanks a lot second one is working
--
India


FSt1 said:
hi
if i understand, you want to replace the result of the find on sheet 1 with
the value of RC on sheet1. if so...

Dim r As String
r = Sheets("sheet1").Range("A1").Value
Sheets("sheet2").Activate
Cells.Find(What:="NOV08987", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

ActiveCell.Value = r

or....
do you want to use the value of sheet1 A1 as the search criteria.
Dim r As String
r = Sheets("sheet1").Range("A1").Value
Sheets("sheet2").Activate
Cells.Find(What:=r, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

post back if i got it all wrong.

Regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top