C
Cor van der Bliek
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.
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.