VBA获取EXCEL列名

View Code
Public Function GetColName(ByVal strAddress As String, ByVal Start As Integer) As String
' Dim strAddress As String
Dim endP As Integer
' strAddress = ActiveCell.Address
'
endP = InStr(2, strAddress, "$")
endP = InStr(Start, strAddress, "$")
GetColName = SubString(strAddress, 2, endP - 1)
Debug.Print GetColName
End Function
View Code
Public Function SubString(ByVal str As String, ByVal Startp As Integer, ByVal endP As Integer) As String
SubString = Mid(str, Startp, endP - Startp + 1)
End Function



原文地址:https://www.cnblogs.com/bjxly/p/2263934.html