Reputation: 105
Trying to find the best way to select the top left cell from a selection. The current code looks too bulky to be the optimal way:
Sub CAIShowHandle()
Dim TopLeftColumn As String
Dim TopLeftRow As String
'changing to only top left cell
With Selection
TopLeftRow = .Row
TopLeftColumn = Col_Letter(.Column)
End With
Range(TopLeftColumn & TopLeftRow).Select
End Sub
Function Col_Letter(lngCol As Long) As String
Dim vArr
vArr = Split(Cells(1, lngCol).Address(True, False), "$")
Col_Letter = vArr(0)
End Function
Is there a better way to write this?
Upvotes: 0
Views: 5934