|
簡単な説明
文字列にする時、文字の先頭に「'」をつけて文字列にする時があります。
(接頭辞と言うらしい。)
このシングルクォーテーションの文字を取得し有無を調べる時のコードです。
A列を調べる場合、
Sub TEST1()
Dim WBN As String, Wsh As String
WBN = "BOOK3.xls" 'ActiveWorkbook.Name
Wsh = "Sheet2" 'ActiveSheet.Name
For i = 1 To Range("A65536").End(xlUp).Row
If ShgQot(WBN, Wsh, Cells(i, "A")) Then
Cells(i, "B").Value = "接頭辞 有り"
Else
Cells(i, "B").Value = "接頭辞 無し"
End If
Next
End Sub
Function ShgQot(WbNm As String, ShNm As String, Cel As Range) As Boolean
Dim RCAd As String, Mc4St As String, BkShN As String
BkShN = "[" & WbNm & "]" & ShNm & "!"
RCAd = Cel.Address(, , xlR1C1)
Mc4St = "GET.CELL(52," & BkShN & RCAd & ")"
If Application.ExecuteExcel4Macro(Mc4St) = "'" Then
ShgQot = True
Else
ShgQot = False
End If
End Function
|
|