View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Capturing last column's letter

Thanks Tom

I copy it in my archive


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Tom Ogilvy" wrote in message ...
On the 19 of Jan, Chip posted this update in the group:

Function ColumnLetter(R As Range) As String
ColumnLetter = Left(R.Address(False, False), _
1 - (R.Column 26) - (R.Column 702))
End Function


--
Regards,
Tom Ogilvy


"Ron de Bruin" wrote:

Hi LarryP

You can use Cells(R,C) if you use the number

With Sheets("Sheet1")
.Cells(1, 22).Value = "Hi"
End With

Another way is to use the Function from Chip Pearson
Not working in Excel 2007

Function ColumnLetter(ColNumber) As String
ColumnLetter = Left(Cells(1, ColNumber).Address(True, False), _
1 - (ColNumber 26))
End Function


Sub test3()
MsgBox ColumnLetter(22)
End Sub



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"LarryP" wrote in message ...
A pesky little thing is eluding me. If I determine that the last used column
in a worksheet is, say, Worksheet.Columns(22), how can I convert that into
"V" so I can subsequently do things to Cell V1? I'm sure there must be some
nifty Property out there somewhere for this purpose, but darn if I've been
able to find it. Surely this isn't going to take some gawdawful Select Case
statement!