Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Converting col number to alpha letter to use in a range...
Range("a1",cells(1,lastcol)).select
is one way. range("a1:a" & lastcol).select is another Lakehills wrote: 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 -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Converting col number to alpha letter to use in a range...
Worked like a charm Dave. Thanks much for the help!
CJM |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Looking up a value within a range of 3 letter or number codes... | Excel Worksheet Functions | |||
formula converting number to column letter 26 | Excel Worksheet Functions | |||
Converting a number to a letter in Excel | Excel Worksheet Functions | |||
Converting a number to a letter in Excel | Excel Worksheet Functions | |||
How do I count the number of alpha occurences in a range? | Excel Worksheet Functions |