Function Col_Letter_To_Number(ColumnLetter As String) As Double Dim cNum As Double 'Get Column Number from Alphabet cNum = Range(ColumnLetter & "1").Column 'Return Column Number Col_Letter_To_Number = cNum End Function In Excel sheet, type ‘=Col_Letter_To_Number(“AA”)’ & press ...
在B列中我们利用自定义函数NZNumToLetter(),输出的结果:二根据字母给出列的数值 我们看一下这个工具的应用界面,如下图:点击后代码会运行,程序中我给出的是”AG”列,要求求出这列的列数值,结果如下:Ø代码见程序文件:VBA_ConvertColumnNumberToLetter.xlsm ...
代码见程序文件:VBA_ConvertColumnNumberToLetter.xlsm
点击后代码会运行,程序中我给出的是”AG”列,要求求出这列的列数值,结果如下: Ø代码见程序文件:VBA_ConvertColumnNumberToLetter.xlsm
Function ColIntToLetter(intCol As Integer) As String '' Dim intPart As Integer Dim intRemainder As Integer If intCol > 255 Or intCol <= 0 Then MsgBox ("The Wrong Column Number: " & CStr(intCol)) Exit Function End If intPart = intCol \ 26 intRemainder = intCol Mod 26 If intPart...
1、返回 Column 英文字: Function ColLetter(ColNumber As Integer ) As String On Error GoTo Errorhandler ColLetter = Left (Cells( 1 , ColNumber).Address( 0 , 0 ), 1 - (ColNumber > 26 )) Exit Function Errorhandler: MsgBox " Error encountered, please re-enter " ...
'### Function ColIntToLetter(intCol As Integer) As String '' Dim intPart As Integer Dim intRemainder As Integer If intCol > 255 Or intCol <= 0 Then MsgBox ("The Wrong Column Number: " & CStr(intCol)) Exit Function End If intPart = intCol \ 26 intRemainder = intCol Mod 26 If...
1、返回 Column 英文字: FunctionColLetter(ColNumberAsInteger)AsString OnErrorGoToErrorhandler ColLetter=Left(Cells(1, ColNumber).Address(0,0),1-(ColNumber>26)) Exit Function Errorhandler: MsgBox"Error encountered, please re-enter" End Function ...
This now gives you the number of the first empty row in column A:To summarize how this works, the search begins at the last row in the worksheet (Rows.Count) then works upwards (xlUp) until it finds a non-empty cell.First non-empty cell using the column letter...
Function Convert_Col_Number_To_Letter(ColumnNumber As Double) As String Dim sLetter As String 'Split Address Letter & Row Number sLetter = Split(Cells(1, ColumnNumber).Address, "$")(1) 'Return only the Column Letter Convert_Col_Number_To_Letter = sLetter End Function ...