Thread: .column
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default .column

EWR,

When you have the column number, you can get the letter by using the
function below.

Use it like

myLetter = ColLet(columnNumber)

But there is never any reason to use the column letter in VBA. Perhaps you
could post your code where you think you need a column letter.

HTH,
Bernie
MS Excel MVP

Function ColLet(ColNum As Integer) As String
If ColNum 26 Then ColLet = Chr((ColNum - 1) \ 26 + 64)
ColLet = ColLet & Chr(((ColNum - 1) Mod 26) + 65)
End Function


"EWR" wrote in message
...
In the range M5:AJ5 I identify the column as "Actual" or "Forecast".
As I loop through the rows, I need to copy only the columns with actual

data
and paste it into another worksheet.
I was able to identify the start column and end column of the actual data,
however the '.column' function gives me the address in R1C1 (eg. 13

through
24). Is there a way to get the column in Local (M through X)?
Probably easy but....
Thanks!