Excel 巨集檢查工作表是否存在的函式
Excel 好像沒有檢查工作表是否存在的原生函式,所以,到網站上找了一個,在跑巨集的時侯可以用
Function sheetExists(sheetToFind As String) As Boolean
sheetExists = False
For Each Sheet In Worksheets
If sheetToFind = Sheet.Name Then
sheetExists = True
Exit Function
End If
Next Sheet
End Function
收工!
Function sheetExists(sheetToFind As String) As Boolean
sheetExists = False
For Each Sheet In Worksheets
If sheetToFind = Sheet.Name Then
sheetExists = True
Exit Function
End If
Next Sheet
End Function
收工!
留言
張貼留言