View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lakehills Lakehills is offline
external usenet poster
 
Posts: 7
Default Converting col number to alpha letter to use in a range...

Hello all,

This is probably a stupid question, but here goes...

My task is to select all the cells in row one (the header row) that
have data in them so I can apply formatting to them.

With the code below, I determine the last used colum, but "LastColumn"
is an integer. Assuming the first column is "A" and the row is always
1, how can I format the range statement? (or is there another way to
do this?)

' Determine last used column...

If WorksheetFunction.CountA(Cells) 0 Then
'Search for any entry, by searching backwards by Columns.
LastColumn = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
MsgBox LastColumn
End If

' Select range ...
Range("A1:?1").Select

Can someone point me in the right direction?

Thanks,
CJM