LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA in Microsoft Excel: Find & Replace method macro across multiple files


I have two files and three columns of data. In Workbook1-sheet1 I want
to copy the value (x) of column B and then search this specific value
in a Range of column A in Workbook2 (imported text file to a new Excel
Worksheet). When I find that value, I want to change the data found in
the row of the substring (started as long 60.ª position with 8
character length) but with column BE to a different value (y) of sheet1
in Workbook1. For example, when I find the number 13090011 (Excel
Workbook1 - "C130508a.SAP") anywhere in the Range of column A (Excel
Workbook2 - "C130508a.SAP.xls"), I want to substitute the substring
character data in cell found with the value "13090017".
The recorded Macro code is below :

Sub Macro1()
'
' Macro1 Macro
' Macro gravada em 07-09-2005 por Administrador
'
' Atalho por teclado: Ctrl+o
'
Range("B1").Select
Selection.Copy
Windows("C130508a.SAP").Activate
Cells.Find(What:="13090011", After:=ActiveCell, LookIn:=xlFormulas,
_
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate
Windows("C130508.SAP.xls").Activate
Range("BE1").Select
Application.CutCopyMode = False
Selection.Copy
Windows("C130508a.SAP").Activate
ActiveCell.Replace What:="13090011", Replacement:="13090017",
LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False
Cells.Find(What:="13090011", After:=ActiveCell, LookIn:=xlFormulas,
_
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate
Windows("C130508.SAP.xls").Activate
End Sub

I need help!, because i want this proceedure to be in a loop clause!
The values to change in first Workbook are variables and macro is only
sucessful using values like constants. The second Workbook to change is
a txt file.

Thanks in advance!

Best regards,

Pedro123


--
Pedro123
------------------------------------------------------------------------
Pedro123's Profile: http://www.excelforum.com/member.php...o&userid=27052
View this thread: http://www.excelforum.com/showthread...hreadid=465485

 
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
How come it say "Microsoft Excel cannot find any data to replace"? Curious[_2_] Excel Discussion (Misc queries) 4 July 16th 09 07:10 PM
Macro Involving Find & Replace In Two Different Files K8_Dog[_2_] Excel Discussion (Misc queries) 4 May 2nd 08 07:44 PM
How to find/replace all of the names of files in EXCEL workbook. Peter Multach Excel Discussion (Misc queries) 2 March 5th 07 02:52 PM
macro to Find Replace in Excel Nurddin Excel Discussion (Misc queries) 7 January 3rd 05 04:29 AM
Import multiple files macro can't find files Steven Rosenberg Excel Programming 1 August 7th 03 01:47 AM


All times are GMT +1. The time now is 08:55 PM.

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"