Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. -- India |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 "Dhimant" wrote: 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. -- India |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 -- Don Guillett Microsoft MVP Excel SalesAid Software "Dhimant" wrote in message ... 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. -- India |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks a lot second one is working
-- India "FSt1" wrote: 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 "Dhimant" wrote: 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. -- India |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Recorded macro | Excel Discussion (Misc queries) | |||
Recorded single column insert in macro. Macro inserts two not one | Excel Programming | |||
How to FIX Recorded Macro | Excel Discussion (Misc queries) | |||
Creating a macro which presses a button containing a recorded macro | Excel Programming |