Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default How to Find values in one worksheet and copy them to a new workshe

I would like to be able to search an entire worksheet for specific values and
when these values are found, copy them to a new worksheet. I have found some
examples here that were close, but not exactly what I needed to do.
I have a workbook that contains dozens of tabs with multiple columns of
alpha-numeric combinations. I want to be able to search the workbook for a
particular combination and when it is found, copy it to a new worksheet in a
single columnar list.
Example:
Sheet1 contains 5 columns A:E.
Each column contains alpha-numeric combinations like A1001234567,
B1001234567, C1001234567.
I would like to find A100* anywhere on Sheet1 and copy the cell that
contains it to worksheet A100. It doesn't have to be in any order and
duplicates are fine. I would just like them to be in one column.
Since I have so many tabs to go through, if it could search one tab, then
move to the next it would be GREAT. If not, I can run it on each tab.

Thanks for any assistance you can provide!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default How to Find values in one worksheet and copy them to a new workshe

Greetings,

Have you seen this?

This code sample searches the columns of a worksheet for the occurrence of a
word ("Hello"). Once matching data is found, it is copied to another
worksheet ("Search Results").

Copy Code
Sub FindMe()
Dim intS As Integer
Dim rngC As Range
Dim strToFind As String, FirstAddress As String
Dim wSht As Worksheet

Application.ScreenUpdating = False

intS = 1
'This step assumes that you have a worksheet named
'Search Results.
Set wSht = Worksheets("Search Results")
strToFind = "Hello"

'Change this range to suit your own needs.
With ActiveSheet.Range("A1:C2000")
Set rngC = .Find(what:=strToFind, LookAt:=xlPart)
If Not rngC Is Nothing Then
FirstAddress = rngC.Address
Do
rngC.EntireRow.Copy wSht.Cells(intS, 1)
intS = intS + 1
Set rngC = .FindNext(rngC)
Loop While Not rngC Is Nothing And rngC.Address <
FirstAddress
End If
End With

End Sub
"Fleone" wrote in message
...
I would like to be able to search an entire worksheet for specific values
and
when these values are found, copy them to a new worksheet. I have found
some
examples here that were close, but not exactly what I needed to do.
I have a workbook that contains dozens of tabs with multiple columns of
alpha-numeric combinations. I want to be able to search the workbook for a
particular combination and when it is found, copy it to a new worksheet in
a
single columnar list.
Example:
Sheet1 contains 5 columns A:E.
Each column contains alpha-numeric combinations like A1001234567,
B1001234567, C1001234567.
I would like to find A100* anywhere on Sheet1 and copy the cell that
contains it to worksheet A100. It doesn't have to be in any order and
duplicates are fine. I would just like them to be in one column.
Since I have so many tabs to go through, if it could search one tab, then
move to the next it would be GREAT. If not, I can run it on each tab.

Thanks for any assistance you can provide!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default How to Find values in one worksheet and copy them to a new wor

carlos,
This works exactly as expected, but doesn't do what I need it to do. The
biggest problem with it is when I move to the next worksheet, any data that
is found that matches my criteria overwrites the data that was written from
the first sheet.
What I need it to do is continue to add to the list on the "Search Results"
worksheet as more matching entries are found on additional worksheets.
I tried changing ActiveSheet.Range to ActiveWorkbook but VB didn't like
that, so I am still looking for a workable solution.
Thanks for your assistance so far, I really appreciate it.

"carlos" wrote:

Greetings,

Have you seen this?

This code sample searches the columns of a worksheet for the occurrence of a
word ("Hello"). Once matching data is found, it is copied to another
worksheet ("Search Results").

Copy Code
Sub FindMe()
Dim intS As Integer
Dim rngC As Range
Dim strToFind As String, FirstAddress As String
Dim wSht As Worksheet

Application.ScreenUpdating = False

intS = 1
'This step assumes that you have a worksheet named
'Search Results.
Set wSht = Worksheets("Search Results")
strToFind = "Hello"

'Change this range to suit your own needs.
With ActiveSheet.Range("A1:C2000")
Set rngC = .Find(what:=strToFind, LookAt:=xlPart)
If Not rngC Is Nothing Then
FirstAddress = rngC.Address
Do
rngC.EntireRow.Copy wSht.Cells(intS, 1)
intS = intS + 1
Set rngC = .FindNext(rngC)
Loop While Not rngC Is Nothing And rngC.Address <
FirstAddress
End If
End With

End Sub
"Fleone" wrote in message
...
I would like to be able to search an entire worksheet for specific values
and
when these values are found, copy them to a new worksheet. I have found
some
examples here that were close, but not exactly what I needed to do.
I have a workbook that contains dozens of tabs with multiple columns of
alpha-numeric combinations. I want to be able to search the workbook for a
particular combination and when it is found, copy it to a new worksheet in
a
single columnar list.
Example:
Sheet1 contains 5 columns A:E.
Each column contains alpha-numeric combinations like A1001234567,
B1001234567, C1001234567.
I would like to find A100* anywhere on Sheet1 and copy the cell that
contains it to worksheet A100. It doesn't have to be in any order and
duplicates are fine. I would just like them to be in one column.
Since I have so many tabs to go through, if it could search one tab, then
move to the next it would be GREAT. If not, I can run it on each tab.

Thanks for any assistance you can provide!




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
Using a cell's value to copy another cells info to another workshe badger2407 Excel Worksheet Functions 1 March 16th 10 09:21 PM
how do I paste linked and embed from worksheet to another workshe. BrianIowaDOT New Users to Excel 1 December 15th 07 04:14 AM
Copy Values from WorkSheet back to Another Workbook Replacing Values in Worksheet bobwilson[_16_] Excel Programming 0 April 3rd 06 09:50 PM
How can I create a button to save one worksheet into a new workshe court Excel Discussion (Misc queries) 2 July 6th 05 06:39 PM
Copy worksheet with Pivot Table and break link to original workshe setter-lover Excel Worksheet Functions 0 November 18th 04 09:29 PM


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

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

About Us

"It's about Microsoft Excel"