nightcrawler23
Well-known Member
- Joined
- Sep 24, 2009
- Messages
- 721
Just as we can have a msgbox return the values vbyes, vbno, vbcancel how can i make function return this.
Below is a code i wrote. but this gives me an error "Argument not optional" and the function name is highlighted.
Below is a code i wrote. but this gives me an error "Argument not optional" and the function name is highlighted.
Code:
Sub sheetExist(prop As String)
Dim sh As Worksheet
For Each sh In ThisWorkbook.Worksheets
If sh.Name = sh.CodeName & "_" & prop Then
sheetExist= MsgBox("sheetExist", _
vbYesNoCancel & vbCritical, "Property Match")
Exit For
End If
Next sh
End Sub