Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default tricky find and replace

Ok I have 400 workbooks where I need to copy information into another cell.
I need it it to search worksheet "Data Entry" for "G. Cut Length" When it
finds that I need it to move down 16 rows. The data in that row needs to be
saved for the find. then I need to move down another 16 rows, the data in
that cell will be what needs to replace the find data. I wand it to search
for the find data on entire workbook and replace it with the other cell. "G.
Cut length is always in column C but the row changes, but the data to find is
alway 16 cells lower, and the to replace the find is always another 16.
Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default tricky find and replace

Sorry for the multiple post I kept recieving an error message saying it
wasn't recieved and to try again.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default tricky find and replace

Here's what I tried and it didn't work. Any Ideas?
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default tricky find and replace

Here's what i tried and it didn't work. Any ideas?


Sub OffsetFindReplacePrint()
strFolder = "C:\Documents and Settings\dwilson\My Documents\Correction"
Set fso = CreateObject _
("Scripting.FileSystemObject")
Set Folder = _
fso.GetFolder(strFolder)

Call OffsetFindReplacePrintSubFolder(strFolder + "\")
End Sub

Sub OffsetFindReplacePrintSubFolder(strFolder)

Dim FindString As String
Dim Rng As Range
Dim ReplaceString As String


Set fso = CreateObject _
("Scripting.FileSystemObject")

Set Folder = _
fso.GetFolder(strFolder)

If Folder.subfolders.Count 0 Then
For Each sf In Folder.subfolders
On Error GoTo 100
Call OffsetFindReplacePrintSubFolder(strFolder + sf.Name + "\")
100 Next sf
End If
'folder size in bytes
On Error GoTo 200
For Each fl In Folder.Files
Ext = fso.GetExtensionName(fl)
If UCase(Left(Ext, 2)) = "XL" Then

Set mybook = Nothing
On Error Resume Next
Set mybook = Workbooks.Open(fl)
On Error GoTo 0

If Not mybook Is Nothing Then

'Change cell value(s)
On Error Resume Next

'Experimental Coding

Application.DisplayAlerts = False
Application.ScreenUpdating = False


With mybook.Worksheets("Data Entry")
FindString = Cells.Find("G. Cut Length").Offset(16)
ReplaceString = Cells.Find("G. Cut Length").Offset(32)
Set Rng = .Replace(What:=FindString, _
Replacement:=ReplaceString, _
after:=.Cells(.Cells.Count), _
Lookat:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False, _
SearchFormat:=False, _
ReplaceFormat:=False)




Worksheets("Report").Select
Range("I2").Select

' ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True
End With

If Err.Number 0 Then
ErrYes = True
Err.Clear
'close without saving
mybook.Close savechanges:=False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Else
mybook.Close savechanges:=True
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End If
Else
ErrorYes = True
End If
End If
Next fl
200 On Error GoTo 0

End Sub









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default tricky find and replace

Send your wb to my address below along with a clear explanation and
before/after examples

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Kiba" wrote in message
...
Here's what I tried and it didn't work. Any Ideas?


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
tricky find and replace Kiba Excel Programming 0 February 9th 09 02:21 PM
Find/Replace Event or Find/Replace for Protected Sheet ... Joe HM Excel Programming 2 October 27th 07 03:55 PM
tricky search and replace john Excel Worksheet Functions 6 September 11th 06 04:41 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
Tricky 'Find Maximum' problem seeks formula tx12345 Excel Worksheet Functions 6 December 5th 05 10:26 PM


All times are GMT +1. The time now is 03:29 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"