TwistShout
New Member
- Joined
- Aug 17, 2011
- Messages
- 15
hello all, first-time poster, long-time reader.
(using excel 2007)
I was hoping to get some help with a small VBA problem I am having. The basic idea of my program will have an input box with a text input and "Go" button. When something is input and and "Go" is engaged, it will search all the open workbooks (and worksheets therein) for the string/number.
I am currently halfway there. The text box input works, but it will only search the active workbook. I know that it is probably a very simple code terminology problem, but I am having trouble finding out the proper way to phrase it.
The debug always catches it in the "cells.find(what......... " portion. That part is from a recorded macro (with the jerry term added in).
Here is my code so far.
(jerry is the text/string/number input from the user form)
Global jerry As String
Sub Macro1()
Dim wb As Workbook, gb As String, ws As Worksheet
UserForm1.Show
For Each wb In Workbooks
For Each ws In Worksheets
Cells.Find(What:=jerry, After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:= xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Next ws
Next wb
End Sub
(using excel 2007)
I was hoping to get some help with a small VBA problem I am having. The basic idea of my program will have an input box with a text input and "Go" button. When something is input and and "Go" is engaged, it will search all the open workbooks (and worksheets therein) for the string/number.
I am currently halfway there. The text box input works, but it will only search the active workbook. I know that it is probably a very simple code terminology problem, but I am having trouble finding out the proper way to phrase it.
The debug always catches it in the "cells.find(what......... " portion. That part is from a recorded macro (with the jerry term added in).
Here is my code so far.
(jerry is the text/string/number input from the user form)
Global jerry As String
Sub Macro1()
Dim wb As Workbook, gb As String, ws As Worksheet
UserForm1.Show
For Each wb In Workbooks
For Each ws In Worksheets
Cells.Find(What:=jerry, After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:= xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Next ws
Next wb
End Sub