Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Help with Data Extract

I'm not even sure this can be done, but I think is should
be possible.

Can you open a mutiple sheet/tab workbook and search each
sheet for rows with a specific value in column A, and
extract each of these rows to a text file?

What if you don't know don't know how many sheets there
are in the workbook, or if the names of the sheets are
not standardized?

Any assistance would be greatly appreciated...

Thanks,
Sean
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help with Data Extract

for each sh in Thisworkbook.worksheets
set rng = sh.Cells.Find(What:="Target")
faddr = rng.Address
if not rng is nothing then
' write to text file
set rng = sh.Cells.FindNext(rng)
Loop until rng.Address = faddr
Next

I doubt you want to write the target string in a text file N times, so I
can't say what you should do once the cell is found in each case.

See help on the Find Method for more arguments that might affect your
search.

See this article for help on writting to a text file (or you could write the
results to a worksheet in a new workbook and then do a SaveAs with a text
fileformat.

http://support.microsoft.com/support...eio/fileio.asp
File Access with Visual Basic® for Applications

--
Regards,
Tom Ogilvy



"Sean Evanovich" wrote in message
...
I'm not even sure this can be done, but I think is should
be possible.

Can you open a mutiple sheet/tab workbook and search each
sheet for rows with a specific value in column A, and
extract each of these rows to a text file?

What if you don't know don't know how many sheets there
are in the workbook, or if the names of the sheets are
not standardized?

Any assistance would be greatly appreciated...

Thanks,
Sean



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Help with Data Extract

Thanks Tom...that seemed to do the trick...I modified it
slightly to look like this...WriteRecord sends my row to
a text file...

Public Sub macro1()

For Each sh In ThisWorkbook.Worksheets
With sh.Range("a1:a999")
Set rng = .Find("A ")
If rng Is Nothing Then
GoTo None_Found
Else
faddr = rng.Address
Do
WriteRecord
Set rng = sh.Cells.FindNext(rng)
Loop Until rng.Address = faddr
End If
End With
None_Found:
Next


-----Original Message-----
for each sh in Thisworkbook.worksheets
set rng = sh.Cells.Find(What:="Target")
faddr = rng.Address
if not rng is nothing then
' write to text file
set rng = sh.Cells.FindNext(rng)
Loop until rng.Address = faddr
Next

I doubt you want to write the target string in a text

file N times, so I
can't say what you should do once the cell is found in

each case.

See help on the Find Method for more arguments that

might affect your
search.

See this article for help on writting to a text file (or

you could write the
results to a worksheet in a new workbook and then do a

SaveAs with a text
fileformat.

http://support.microsoft.com/support...content/fileio

/fileio.asp
File Access with Visual Basic® for Applications

--
Regards,
Tom Ogilvy



"Sean Evanovich"

wrote in message
...
I'm not even sure this can be done, but I think is

should
be possible.

Can you open a mutiple sheet/tab workbook and search

each
sheet for rows with a specific value in column A, and
extract each of these rows to a text file?

What if you don't know don't know how many sheets there
are in the workbook, or if the names of the sheets are
not standardized?

Any assistance would be greatly appreciated...

Thanks,
Sean



.

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
Data extract Brad Autry Excel Worksheet Functions 10 January 14th 10 08:46 AM
Tying to extract all data from a pivot pulling from external data Ted Urban Excel Discussion (Misc queries) 3 September 14th 07 10:50 AM
data extract Mona Excel Worksheet Functions 7 May 10th 06 05:17 PM
How to extract the data Shiva Excel Worksheet Functions 2 November 1st 05 04:41 AM


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