Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to search for and copy all instances of a found string in
the workbook to another workbook. I found code (not mine, I can't get a batch file to echo hello) to search and find the string, but don't know how to get it to write every instance it finds to another new workbook. Can someone help? Thanks Sub FindAcrossMultipleSheets() Dim findStr As String Dim wkSht As Worksheet Dim found As Range Dim foundAddr As String Dim yesNoResult As Integer findStr = InputBox("Find what:", "Find Across Sheets", ActiveCell.Value) On Error Resume Next For Each wkSht In Sheets With wkSht 'Set found = .Cells.Find(What:=findStr, After:=.Range("A1"), _ MatchCase:=True) Set found = .Cells.Find(What:=findStr, LookIn:=xlValues, _ Lookat:=xlPart, MatchCase:=False) 'Set cll = .Find(FindString, LookIn:=xlValues, _ LookAt:=xlPart, MatchCase:=False) If Not found Is Nothing Then foundAddr = found.Address Do .Activate found.Activate yesNoResult = MsgBox("Find " & findStr & " Again?", vbYesNo) If yesNoResult = vbNo Then Exit For Set found = .Cells.FindNext(After:=ActiveCell) Loop Until found.Address = foundAddr Set found = Nothing End If End With Next wkSht If found Is Nothing Then MsgBox findStr & " not found." On Error GoTo 0 End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
find and copy it.. | Excel Discussion (Misc queries) | |||
Copy contents of Find (Find and Replace) | Excel Discussion (Misc queries) | |||
FIND AND COPY | Excel Programming | |||
Find a day and copy | Excel Programming | |||
Find and Copy ? | Excel Programming |