Hi,
i want to write a macro that will create sheet "Check" if workbook name contain "Mobile" in his name. Can someone help me please
Hi,
i want to write a macro that will create sheet "Check" if workbook name contain "Mobile" in his name. Can someone help me please
Function Test() If InStr(ThisWorkbook.Name, "Check") <> 0 Then If Not WorkSheetExists("Mobile") Then Worksheets.Add After:=Worksheets(Worksheets.Count) ActiveSheet.Name = "Mobile" End If End If End Function 'WorkSheetExists in a workbook: Function WorkSheetExists(sWorkSheet As String, Optional sWorkbook As String = "") As Boolean Dim ws As Worksheet, wb As Workbook On Error GoTo notExists If sWorkbook = "" Then Set wb = ActiveWorkbook Else Set wb = Workbooks(sWorkbook) End If Set ws = wb.Worksheets(sWorkSheet) WorkSheetExists = True Exit Function notExists: WorkSheetExists = False End Function