@mkkajtez wrote:
I have a macro called “vin_search” in an excel file with the following code
Sub vin_search(Optional vin As String) ActiveWorkbook.Sheets("BLANK").Activate Dim WS_Count As Integer WS_Count = ActiveWorkbook.Sheets.Count Dim Z As Integer For Z = 1 To WS_Count ActiveWorkbook.Worksheets(Z).Activate Dim Cell As Range Columns("C:C").Select Set Cell = Selection.Find(What:=vin, After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) If Cell Is Nothing Then Else MsgBox ("Found") MsgBox (Cells(Cell.Row, Cell.Column + 1).Value) Exit For End If Next Z End Sub
When I call it with Execute Macro it never finds the expected vin, however when I run it directly through excel, no problems. Any thoughts?
Posts: 4
Participants: 3