|
'Columnのアルファベット名(A,B,C....)を取得するのは、
'余り意味が無い様な気しますが(列番号で大抵の事は、出来ます)
'如何しても必要なら
Option Explicit
Sub text()
Dim R As Range
Dim Col_XXX As String
Set R = Rows("1:1").Find("XXX", LookIn:=xlValues, LookAt:=xlWhole)
If Not (R Is Nothing) Then
Col_XXX = GetColumnChr(R.Column)
End If
End Sub
Public Function GetColumnChr(ByVal vntMark As Variant) As String
Dim strFChr As String
Dim strRChr As String
If Val(vntMark) <= 0 Or 256 < Val(vntMark) Then
Exit Function
End If
vntMark = Val(vntMark) - 1
If (vntMark) \ 26 = 0 Then
strFChr = ""
Else
strFChr = Chr((vntMark) \ 26 + &H40)
End If
strRChr = Chr((vntMark) Mod 26 + &H41)
GetColumnChr = strFChr & strRChr
End Function
|
|