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 ...
代码见程序文件:VBA_ConvertColumnNumberToLetter.xlsm
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 " End Function 1. 2. 3. 4. 5. 6. 7. 2、...
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 = 0 Then ColIntToLetter = Chr(intCol + 64) ElseIf intPart = 1 And intRemainder = 0 Then ColIntToLe...
Also called GetColumnName, ColumnNumberToLetter ColumnNumberToNa,e Question I would like to hide a row if certain values are entered in three cells. For e.g. if United Kingdom is selected in Cell C3 and C5 and CI is selected from cell C10, I would then have Row 16 hidden. I would ...
'### 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...
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...
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 ...
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 This function can ...
Use this VBA function to convert a column number to a letter. This is useful if you need to build a range and you want to do so with the A1 notation.