Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GTS GTS is offline
external usenet poster
 
Posts: 1
Default Multiple worksheets search

Hello people,

i'm not a programmer and i know only a few things about VB. My problem
is this:

i wanted to create a macro where i would be able to perform the search
action in all worksheets of an excel workbook. So, i created a "Find
All" menu item and when it is clicked a search-like form is opened. The
search is performed like this:

Private Sub FindCB_Click() 'This is the Find Next button in my form

Dim sh As Worksheet
Dim rng As Range, firstAddress As String


For Each sh In ThisWorkbook.Worksheets

Set rng = sh.Cells.Find(What:="*" & FindAllForm.TextBox1.Text & "*",
After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole,
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)

If Not rng Is Nothing Then

firstAddress = rng.Address

Do

If Not rng Is Nothing Then

Application.Goto rng, True


End If

Set rng = sh.Cells.FindNext(rng)

Loop Until (rng.Address = firstAddress)


End If

Next



So, when the code is executed it goes directly into the last string it
finds, skipping all the intermediate strings. How can i make it stop in
every string it finds? And then by clicking the button to go to the
next one? Like the classic Find option in excel?

Thank you very much in advance!


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Multiple worksheets search

If you have excel 2000 or later, you don't need your own special button.
just group the sheets before you do the search and use the classic find
button.

--
Regards,
Tom Ogilvy

"GTS " wrote in message
...
Hello people,

i'm not a programmer and i know only a few things about VB. My problem
is this:

i wanted to create a macro where i would be able to perform the search
action in all worksheets of an excel workbook. So, i created a "Find
All" menu item and when it is clicked a search-like form is opened. The
search is performed like this:

Private Sub FindCB_Click() 'This is the Find Next button in my form

Dim sh As Worksheet
Dim rng As Range, firstAddress As String


For Each sh In ThisWorkbook.Worksheets

Set rng = sh.Cells.Find(What:="*" & FindAllForm.TextBox1.Text & "*",
After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole,
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)

If Not rng Is Nothing Then

firstAddress = rng.Address

Do

If Not rng Is Nothing Then

Application.Goto rng, True


End If

Set rng = sh.Cells.FindNext(rng)

Loop Until (rng.Address = firstAddress)


End If

Next



So, when the code is executed it goes directly into the last string it
finds, skipping all the intermediate strings. How can i make it stop in
every string it finds? And then by clicking the button to go to the
next one? Like the classic Find option in excel?

Thank you very much in advance!


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Multiple worksheets search

Hi

In Excel 2002/2003, there is a "Within:" option in the Find/Replace dialog.
You can choose workbook.

You don't have to select all sheets then like Tom suggested

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Tom Ogilvy" wrote in message ...
If you have excel 2000 or later, you don't need your own special button.
just group the sheets before you do the search and use the classic find
button.

--
Regards,
Tom Ogilvy

"GTS " wrote in message
...
Hello people,

i'm not a programmer and i know only a few things about VB. My problem
is this:

i wanted to create a macro where i would be able to perform the search
action in all worksheets of an excel workbook. So, i created a "Find
All" menu item and when it is clicked a search-like form is opened. The
search is performed like this:

Private Sub FindCB_Click() 'This is the Find Next button in my form

Dim sh As Worksheet
Dim rng As Range, firstAddress As String


For Each sh In ThisWorkbook.Worksheets

Set rng = sh.Cells.Find(What:="*" & FindAllForm.TextBox1.Text & "*",
After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole,
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)

If Not rng Is Nothing Then

firstAddress = rng.Address

Do

If Not rng Is Nothing Then

Application.Goto rng, True


End If

Set rng = sh.Cells.FindNext(rng)

Loop Until (rng.Address = firstAddress)


End If

Next



So, when the code is executed it goes directly into the last string it
finds, skipping all the intermediate strings. How can i make it stop in
every string it finds? And then by clicking the button to go to the
next one? Like the classic Find option in excel?

Thank you very much in advance!


---
Message posted from http://www.ExcelForum.com/





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Multiple worksheets search

Does it work if you do group the sheets and don't make a "Within" selection?

--
Regards,
Tom Ogilvy

"Ron de Bruin" wrote in message
...
Hi

In Excel 2002/2003, there is a "Within:" option in the Find/Replace

dialog.
You can choose workbook.

You don't have to select all sheets then like Tom suggested

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Tom Ogilvy" wrote in message

...
If you have excel 2000 or later, you don't need your own special button.
just group the sheets before you do the search and use the classic find
button.

--
Regards,
Tom Ogilvy

"GTS " wrote in message
...
Hello people,

i'm not a programmer and i know only a few things about VB. My problem
is this:

i wanted to create a macro where i would be able to perform the search
action in all worksheets of an excel workbook. So, i created a "Find
All" menu item and when it is clicked a search-like form is opened.

The
search is performed like this:

Private Sub FindCB_Click() 'This is the Find Next button in my form

Dim sh As Worksheet
Dim rng As Range, firstAddress As String


For Each sh In ThisWorkbook.Worksheets

Set rng = sh.Cells.Find(What:="*" & FindAllForm.TextBox1.Text & "*",
After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole,
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)

If Not rng Is Nothing Then

firstAddress = rng.Address

Do

If Not rng Is Nothing Then

Application.Goto rng, True


End If

Set rng = sh.Cells.FindNext(rng)

Loop Until (rng.Address = firstAddress)


End If

Next



So, when the code is executed it goes directly into the last string it
finds, skipping all the intermediate strings. How can i make it stop

in
every string it finds? And then by clicking the button to go to the
next one? Like the classic Find option in excel?

Thank you very much in advance!


---
Message posted from http://www.ExcelForum.com/







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Multiple worksheets search

Hi Tom

Yes it is working then

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Tom Ogilvy" wrote in message ...
Does it work if you do group the sheets and don't make a "Within" selection?

--
Regards,
Tom Ogilvy

"Ron de Bruin" wrote in message
...
Hi

In Excel 2002/2003, there is a "Within:" option in the Find/Replace

dialog.
You can choose workbook.

You don't have to select all sheets then like Tom suggested

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Tom Ogilvy" wrote in message

...
If you have excel 2000 or later, you don't need your own special button.
just group the sheets before you do the search and use the classic find
button.

--
Regards,
Tom Ogilvy

"GTS " wrote in message
...
Hello people,

i'm not a programmer and i know only a few things about VB. My problem
is this:

i wanted to create a macro where i would be able to perform the search
action in all worksheets of an excel workbook. So, i created a "Find
All" menu item and when it is clicked a search-like form is opened.

The
search is performed like this:

Private Sub FindCB_Click() 'This is the Find Next button in my form

Dim sh As Worksheet
Dim rng As Range, firstAddress As String


For Each sh In ThisWorkbook.Worksheets

Set rng = sh.Cells.Find(What:="*" & FindAllForm.TextBox1.Text & "*",
After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole,
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)

If Not rng Is Nothing Then

firstAddress = rng.Address

Do

If Not rng Is Nothing Then

Application.Goto rng, True


End If

Set rng = sh.Cells.FindNext(rng)

Loop Until (rng.Address = firstAddress)


End If

Next



So, when the code is executed it goes directly into the last string it
finds, skipping all the intermediate strings. How can i make it stop

in
every string it finds? And then by clicking the button to go to the
next one? Like the classic Find option in excel?

Thank you very much in advance!


---
Message posted from http://www.ExcelForum.com/











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Multiple worksheets search

Thanks for testing.

Regards,
Tom Ogilvy

"Ron de Bruin" wrote in message
...
Hi Tom

Yes it is working then

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Tom Ogilvy" wrote in message

...
Does it work if you do group the sheets and don't make a "Within"

selection?

--
Regards,
Tom Ogilvy

"Ron de Bruin" wrote in message
...
Hi

In Excel 2002/2003, there is a "Within:" option in the Find/Replace

dialog.
You can choose workbook.

You don't have to select all sheets then like Tom suggested

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Tom Ogilvy" wrote in message

...
If you have excel 2000 or later, you don't need your own special

button.
just group the sheets before you do the search and use the classic

find
button.

--
Regards,
Tom Ogilvy

"GTS " wrote in message
...
Hello people,

i'm not a programmer and i know only a few things about VB. My

problem
is this:

i wanted to create a macro where i would be able to perform the

search
action in all worksheets of an excel workbook. So, i created a

"Find
All" menu item and when it is clicked a search-like form is

opened.
The
search is performed like this:

Private Sub FindCB_Click() 'This is the Find Next button in my

form

Dim sh As Worksheet
Dim rng As Range, firstAddress As String


For Each sh In ThisWorkbook.Worksheets

Set rng = sh.Cells.Find(What:="*" & FindAllForm.TextBox1.Text &

"*",
After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole,
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)

If Not rng Is Nothing Then

firstAddress = rng.Address

Do

If Not rng Is Nothing Then

Application.Goto rng, True


End If

Set rng = sh.Cells.FindNext(rng)

Loop Until (rng.Address = firstAddress)


End If

Next



So, when the code is executed it goes directly into the last

string it
finds, skipping all the intermediate strings. How can i make it

stop
in
every string it finds? And then by clicking the button to go to

the
next one? Like the classic Find option in excel?

Thank you very much in advance!


---
Message posted from http://www.ExcelForum.com/











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 Multiple Worksheets Bob[_16_] Excel Discussion (Misc queries) 3 March 21st 10 08:18 PM
Search in Multiple Worksheets Lizz45ie Excel Discussion (Misc queries) 0 October 19th 05 05:22 PM
Search multiple worksheets tupenny Excel Worksheet Functions 1 October 14th 05 09:12 AM
Search multiple worksheets - Excel 97 Fybo Excel Discussion (Misc queries) 3 September 16th 05 04:19 PM
Search Multiple Worksheets jtinne Excel Discussion (Misc queries) 4 February 3rd 05 07:26 PM


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