Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Search acrross Workbboks & Worksheets???

This pseudo code should get you started:

Dim lbox as Listbox
set lbox = Sheet1!Listbox1
for each wkbk in Workbooks
for each ws in wkbk.Worksheets

With ws.cells
Set c = .Find("Target", lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
lbox.AddItem c.Address(0,0,xlA1,True)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
Next ws
Next wkbk

--
Regards,
Tom Ogilvy

"Chris" wrote
in message ...
Hi
I hope someone can help me out there.
I need to SEARCH for a string across all open workbooks &
all sheets with in those workbook. Then list the location
of each find in a List Box. Once user select a location
from List it takes them to it.
Is it possible ????
I use XL2002 on Win2K

Thanks a million in advance

Regards
Chris



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Search acrross Workbboks & Worksheets???

Hi Tom

Thank you so much for the help. I almost got it working
now. Please see below. I have used it on Userform2. It
works fine & [populate the List Box with all find within
all open workbooks & worksheet & it also is fine when
selecting any range with in active workbook, however it
fails & gives run time error "Acticate methood failed"
when I try to select something which is not the active
book.
Please advise what changes are required to ListBox1_Click
procedure to make it work

Thanks a million

Private Sub ListBox1_Click()

With Me.ListBox1

Range(ListBox1.Value).Activate
End With
End Sub

Private Sub UserForm_Initialize()

For Each wkbk In Workbooks
For Each WS In wkbk.Worksheets

With WS.Cells
Set c = .Find("289917-002", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Me.ListBox1.AddItem c.Address(0, 0, xlA1, True)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <
firstAddress
End If
End With
Next WS
Next wkbk


End Sub

-----Original Message-----
This pseudo code should get you started:

Dim lbox as Listbox
set lbox = Sheet1!Listbox1
for each wkbk in Workbooks
for each ws in wkbk.Worksheets

With ws.cells
Set c = .Find("Target", lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
lbox.AddItem c.Address(0,0,xlA1,True)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <

firstAddress
End If
End With
Next ws
Next wkbk

--
Regards,
Tom Ogilvy

"Chris" wrote
in message ...
Hi
I hope someone can help me out there.
I need to SEARCH for a string across all open workbooks

&
all sheets with in those workbook. Then list the

location
of each find in a List Box. Once user select a location
from List it takes them to it.
Is it possible ????
I use XL2002 on Win2K

Thanks a million in advance

Regards
Chris



.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Search acrross Workbboks & Worksheets???

Private Sub ListBox1_Click()

Application.Goto range(Listbox1.Value) , True
End Sub

if that doesn't work
Private Sub ListBox1_Click()
Dim rng as Range
set rng = Range(Listbox1.Value)
rng.parent.parent.Activate
rng.parent.Activate
rng.select
End Sub

--
Regards,
Tom Ogilvy


"Chris" wrote in message
...
Hi Tom

Thank you so much for the help. I almost got it working
now. Please see below. I have used it on Userform2. It
works fine & [populate the List Box with all find within
all open workbooks & worksheet & it also is fine when
selecting any range with in active workbook, however it
fails & gives run time error "Acticate methood failed"
when I try to select something which is not the active
book.
Please advise what changes are required to ListBox1_Click
procedure to make it work

Thanks a million

Private Sub ListBox1_Click()

With Me.ListBox1

Range(ListBox1.Value).Activate
End With
End Sub

Private Sub UserForm_Initialize()

For Each wkbk In Workbooks
For Each WS In wkbk.Worksheets

With WS.Cells
Set c = .Find("289917-002", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Me.ListBox1.AddItem c.Address(0, 0, xlA1, True)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <
firstAddress
End If
End With
Next WS
Next wkbk


End Sub

-----Original Message-----
This pseudo code should get you started:

Dim lbox as Listbox
set lbox = Sheet1!Listbox1
for each wkbk in Workbooks
for each ws in wkbk.Worksheets

With ws.cells
Set c = .Find("Target", lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
lbox.AddItem c.Address(0,0,xlA1,True)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <

firstAddress
End If
End With
Next ws
Next wkbk

--
Regards,
Tom Ogilvy

"Chris" wrote
in message ...
Hi
I hope someone can help me out there.
I need to SEARCH for a string across all open workbooks

&
all sheets with in those workbook. Then list the

location
of each find in a List Box. Once user select a location
from List it takes them to it.
Is it possible ????
I use XL2002 on Win2K

Thanks a million in advance

Regards
Chris



.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Search acrross Workbboks & Worksheets???

Wow!!!!
The 1st option worked right away..thanks a million

-----Original Message-----
Private Sub ListBox1_Click()

Application.Goto range(Listbox1.Value) , True
End Sub

if that doesn't work
Private Sub ListBox1_Click()
Dim rng as Range
set rng = Range(Listbox1.Value)
rng.parent.parent.Activate
rng.parent.Activate
rng.select
End Sub

--
Regards,
Tom Ogilvy


"Chris" wrote in

message
...
Hi Tom

Thank you so much for the help. I almost got it working
now. Please see below. I have used it on Userform2. It
works fine & [populate the List Box with all find within
all open workbooks & worksheet & it also is fine when
selecting any range with in active workbook, however it
fails & gives run time error "Acticate methood failed"
when I try to select something which is not the active
book.
Please advise what changes are required to

ListBox1_Click
procedure to make it work

Thanks a million

Private Sub ListBox1_Click()

With Me.ListBox1

Range(ListBox1.Value).Activate
End With
End Sub

Private Sub UserForm_Initialize()

For Each wkbk In Workbooks
For Each WS In wkbk.Worksheets

With WS.Cells
Set c = .Find("289917-002", LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
Me.ListBox1.AddItem c.Address(0, 0, xlA1,

True)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <
firstAddress
End If
End With
Next WS
Next wkbk


End Sub

-----Original Message-----
This pseudo code should get you started:

Dim lbox as Listbox
set lbox = Sheet1!Listbox1
for each wkbk in Workbooks
for each ws in wkbk.Worksheets

With ws.cells
Set c = .Find("Target", lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
lbox.AddItem c.Address(0,0,xlA1,True)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <

firstAddress
End If
End With
Next ws
Next wkbk

--
Regards,
Tom Ogilvy

"Chris" wrote
in message news:08bc01c3adee$4db07ee0

...
Hi
I hope someone can help me out there.
I need to SEARCH for a string across all open

workbooks
&
all sheets with in those workbook. Then list the

location
of each find in a List Box. Once user select a

location
from List it takes them to it.
Is it possible ????
I use XL2002 on Win2K

Thanks a million in advance

Regards
Chris


.



.

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
search for a particular cell in worksheets JoviGirl Excel Worksheet Functions 2 January 14th 09 11:45 PM
Search for duplicates across three worksheets Sarah_Lund Excel Worksheet Functions 1 May 20th 08 12:29 AM
Search in Multiple Worksheets Lizz45ie Excel Discussion (Misc queries) 0 October 19th 05 05:22 PM
search worksheets Anthony Excel Discussion (Misc queries) 11 July 14th 05 03:24 PM
Search Mutiple WorkSheets Ben Jimenez Excel Programming 5 July 29th 03 09:48 PM


All times are GMT +1. The time now is 04:50 PM.

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"