Thread: .column
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
EWR EWR is offline
external usenet poster
 
Posts: 8
Default .column

Sorry...I am no expert here...

'get actual range
Sheets(wrk1).Select
Range("M5").Select
val = ActiveCell.Value
'Set begin column
While ActiveCell.Value < "Actual" And i < 25
ActiveCell.Offset(0, 1).Select
i = i + 1
Wend

beg = ActiveCell.Column
i = i + 1
ActiveCell.Offset(0, 1).Select
i = i + 1
'Set end column
While ActiveCell.Value = "Actual" And i < 25
ActiveCell.Offset(0, 1).Select
i = i + 1
Wend
end_col = ActiveCell.Column - 1
'MsgBox beg & " " & end_col

....Loop through rows, find location...

'get range of actuals
act_row =activecell.row
bcell = "R" & act_row & "C" & beg_acts
ecell = "R" & act_row & "C" & end_acts
rng = bcell & ":" & ecell
Range(rng).Select


"Bernie Deitrick" wrote:

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!