ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   "Find" Macro not working for some (https://www.excelbanter.com/excel-programming/305884-find-macro-not-working-some.html)

Riz[_2_]

"Find" Macro not working for some
 
Hi,

I have created a button in the excel spread sheet
for "Find" or "Search. This is the code:

Sub Find()
Range("A2:F37").Select
Cells.Find(What:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate
Application.Dialogs(xlDialogFormulaReplace).Show
End Sub

It works fine for me, however when I send it out to
everyone else they are not able to make it work. It opens
the VB Code window. Is there something I can do to just
this spreadsheet so they dont have to change the macro
setting and the search button actaully searchs instead of
openeing the code window?

Thanks for youe help.

Riz

Tom Ogilvy

"Find" Macro not working for some
 
Sub Find()
On Error Resume Next
Range("A2:F37").Select
Cells.Find(What:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate
Application.Dialogs(xlDialogFormulaReplace).Show
On Error goto 0
End Sub

Although you macro requires the user to select the cell containing the value
to be searched for before running the macro. Perhaps they are not doing
that.

--
Regards,
Tom Ogilvy


"Riz" wrote in message
...
Hi,

I have created a button in the excel spread sheet
for "Find" or "Search. This is the code:

Sub Find()
Range("A2:F37").Select
Cells.Find(What:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate
Application.Dialogs(xlDialogFormulaReplace).Show
End Sub

It works fine for me, however when I send it out to
everyone else they are not able to make it work. It opens
the VB Code window. Is there something I can do to just
this spreadsheet so they dont have to change the macro
setting and the search button actaully searchs instead of
openeing the code window?

Thanks for youe help.

Riz





All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com