寫函式判斷啊:
Function CellType(pRange As Range)
Application.Volatile
Set pRange = pRange.Range("A1")
Select Case True
Case VBA.IsEmpty(pRange): CellType = "空白"
Case Application.IsText(pRange): CellType = "文字"
Case Application.IsLogical(pRange): CellType = "邏輯"
Case Application.IsErr(pRange): CellType = "錯誤"
Case VBA.IsDate(pRange): CellType = "日期"
Case VBA.InStr(1, pRange.Text, ":") <> 0: CellType = "時間"
Case VBA.IsNumeric(pRange): CellType = "常規數值"
End Select
End Function
寫函式判斷啊:
Function CellType(pRange As Range)
Application.Volatile
Set pRange = pRange.Range("A1")
Select Case True
Case VBA.IsEmpty(pRange): CellType = "空白"
Case Application.IsText(pRange): CellType = "文字"
Case Application.IsLogical(pRange): CellType = "邏輯"
Case Application.IsErr(pRange): CellType = "錯誤"
Case VBA.IsDate(pRange): CellType = "日期"
Case VBA.InStr(1, pRange.Text, ":") <> 0: CellType = "時間"
Case VBA.IsNumeric(pRange): CellType = "常規數值"
End Select
End Function