G
Guest
I'm new to Excel programming . . . The following procedure finds a string in
a column, then goes a couple columns over (determined via user input) and
enters a category.
The procedure finds the appropriate entry and enters the text in a column,
on the same row, as it should.
However, it continues to loop through the spreadsheet, until I do a
Ctrl+Break.
How do I determine when the Find method has gone through the worksheet once.
Thanks in advance,
Rich
This is the loop:
Do
Cells.Find(What:=txtSrchString, After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=True, _
SearchFormat:=False).Activate
CellAddress = txtOutputCol & ActiveCell.Row
Range(CellAddress).Select
ActiveCell.Value = txtReplString
Loop Until Cells.Find(What:=txtSrchString, After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=True, _
SearchFormat:=False) <> txtSrchString.Text
a column, then goes a couple columns over (determined via user input) and
enters a category.
The procedure finds the appropriate entry and enters the text in a column,
on the same row, as it should.
However, it continues to loop through the spreadsheet, until I do a
Ctrl+Break.
How do I determine when the Find method has gone through the worksheet once.
Thanks in advance,
Rich
This is the loop:
Do
Cells.Find(What:=txtSrchString, After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=True, _
SearchFormat:=False).Activate
CellAddress = txtOutputCol & ActiveCell.Row
Range(CellAddress).Select
ActiveCell.Value = txtReplString
Loop Until Cells.Find(What:=txtSrchString, After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=True, _
SearchFormat:=False) <> txtSrchString.Text