10shlomi10
12-23-2016, 06:19 PM
Hi
I need help with UDF please.
I have the a cells range with columns letters.
I want to build a UDF that will return the highest column latter BUT as A Number (what is called: Excel column number index).
I start writing something but I'm stack ...
Public Function MaxColNum(ByRef rng As Range, ColNm As Variant)'convert column Letter to Number and find the Largest column
LastCol = ActiveSheet.Cells("A", Columns.Count).End(xlToLeft).Column
lastColLetter = Range(LastCol, LastCol & 1).Column
Set rng = Range("C2:" & lastColLetter & Rows.Count)
For Each ColNm In rng
MaxColNum = Range(ColNm, ColNm & 1).Column
Next
'MaxwColNm = ......
End Function
C2 is the first cell to search till the end of rows+end of columns
17898
Thanks !
I need help with UDF please.
I have the a cells range with columns letters.
I want to build a UDF that will return the highest column latter BUT as A Number (what is called: Excel column number index).
I start writing something but I'm stack ...
Public Function MaxColNum(ByRef rng As Range, ColNm As Variant)'convert column Letter to Number and find the Largest column
LastCol = ActiveSheet.Cells("A", Columns.Count).End(xlToLeft).Column
lastColLetter = Range(LastCol, LastCol & 1).Column
Set rng = Range("C2:" & lastColLetter & Rows.Count)
For Each ColNm In rng
MaxColNum = Range(ColNm, ColNm & 1).Column
Next
'MaxwColNm = ......
End Function
C2 is the first cell to search till the end of rows+end of columns
17898
Thanks !