Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default interactive findnext

In a macro I need to find a value in any of 10 workbooks. Anytime the value
from a userform is found the macro should halt a let me do anything outside
the macro just like the standard find/findnext function.
This works, except for the part, where the macro needs to halt and I can do
anything until I use the Next button on the userform

For i = 1 To 10
Workbooks(Files(i)).Activate
For j = 1 To Worksheets.Count
With Worksheets(j).Range("A1:A2000")
Set c = .Find(Nr, LookIn:=xlValues)
If Not c Is Nothing Then
If Nr = "" Then Exit Sub
firstAddress = c.Address
Worksheets(j).Activate
Range(firstAddress).Select
Do
Set c = .FindNext(c)
nextAddress = c.Address
Range(nextAddress).Select
something here!!
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
Next
Next

something here!!!
can be a Msgbox or Inputbox of course, but using any of these prevents me
from using the spreadsheet because the macro still has control. The standard
Excel find/findnext function stops and lets the user take control. How is
that done?

My userform is used vbModeless.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 151
Default interactive findnext

Hi there,

I think perhaps you need to separate the Find and the Find Next.
The Find goes to the first instance and the Find Next loops through the
matches after the activecell. I'm not sure how this would cope with 10
workbooks.
Alternatively you could list the locations of all the matches in a listbox
hidden and then use the Next to increment down the list.


"Cor van der Bliek" wrote:

In a macro I need to find a value in any of 10 workbooks. Anytime the value
from a userform is found the macro should halt a let me do anything outside
the macro just like the standard find/findnext function.
This works, except for the part, where the macro needs to halt and I can do
anything until I use the Next button on the userform

For i = 1 To 10
Workbooks(Files(i)).Activate
For j = 1 To Worksheets.Count
With Worksheets(j).Range("A1:A2000")
Set c = .Find(Nr, LookIn:=xlValues)
If Not c Is Nothing Then
If Nr = "" Then Exit Sub
firstAddress = c.Address
Worksheets(j).Activate
Range(firstAddress).Select
Do
Set c = .FindNext(c)
nextAddress = c.Address
Range(nextAddress).Select
something here!!
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
Next
Next

something here!!!
can be a Msgbox or Inputbox of course, but using any of these prevents me
from using the spreadsheet because the macro still has control. The standard
Excel find/findnext function stops and lets the user take control. How is
that done?

My userform is used vbModeless.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default interactive findnext

That's not what I'm looking for. It should behave jus like the program's
Find/Find next function. When an occurence of the key is found it stops and
let's me full control. Using the next key I can choose the next occurence and
so on.

"Libby" wrote:

Hi there,

I think perhaps you need to separate the Find and the Find Next.
The Find goes to the first instance and the Find Next loops through the
matches after the activecell. I'm not sure how this would cope with 10
workbooks.
Alternatively you could list the locations of all the matches in a listbox
hidden and then use the Next to increment down the list.


"Cor van der Bliek" wrote:

In a macro I need to find a value in any of 10 workbooks. Anytime the value
from a userform is found the macro should halt a let me do anything outside
the macro just like the standard find/findnext function.
This works, except for the part, where the macro needs to halt and I can do
anything until I use the Next button on the userform

For i = 1 To 10
Workbooks(Files(i)).Activate
For j = 1 To Worksheets.Count
With Worksheets(j).Range("A1:A2000")
Set c = .Find(Nr, LookIn:=xlValues)
If Not c Is Nothing Then
If Nr = "" Then Exit Sub
firstAddress = c.Address
Worksheets(j).Activate
Range(firstAddress).Select
Do
Set c = .FindNext(c)
nextAddress = c.Address
Range(nextAddress).Select
something here!!
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
Next
Next

something here!!!
can be a Msgbox or Inputbox of course, but using any of these prevents me
from using the spreadsheet because the macro still has control. The standard
Excel find/findnext function stops and lets the user take control. How is
that done?

My userform is used vbModeless.

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
Do I need Findnext? Not sure how Tim[_51_] Excel Programming 0 February 5th 09 04:49 AM
Findnext Noemi Excel Discussion (Misc queries) 1 December 12th 05 11:23 AM
iNTERACTIVE EXCEL FILE NOT INTERACTIVE ON THE WEB kathy in kansas Excel Discussion (Misc queries) 0 January 24th 05 07:47 PM
FindNext John Keturi Excel Programming 1 October 16th 04 01:56 PM
FindNext SJ[_6_] Excel Programming 7 May 21st 04 06:01 AM


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