Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Modification in Recorded Macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Modification in Recorded Macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Modification in Recorded Macro

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Modification in Recorded Macro

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Recorded macro Gaurav[_3_] Excel Discussion (Misc queries) 4 September 22nd 08 06:46 PM
Recorded single column insert in macro. Macro inserts two not one lostatlewisu Excel Programming 3 August 16th 07 01:26 AM
How to FIX Recorded Macro JMay Excel Discussion (Misc queries) 7 May 23rd 07 04:13 AM
Creating a macro which presses a button containing a recorded macro petros89[_3_] Excel Programming 3 October 5th 05 02:49 PM


All times are GMT +1. The time now is 04:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"