View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
mcphc mcphc is offline
external usenet poster
 
Posts: 44
Default Column letter reference as number reference

Thanks for the help guys but not quiet what I was looking for.

The problem is the print area is always different so it could be

For col= 1 to 52

or

For col = 1 to 30

I need something like

For col= 1 to PrintAreaEdge

where PrintAreaEdge is the last vertical column number (ie 52 not letter
"AZ") in the print area.

Using the below

For Each a In Range("print_Area")
MsgBox a
Next

is close but I actually only want to search a few columns within the print
area
ie

For col = 1 to PrintAreaEdge - 5

Thanks

"Jason Lepack" wrote:

public sub mcphc()
dim r as integer, c as integer
' rows 1 to 57
for r = 1 to 57
' columns A to AZ
for c = 1 to 52
' Print value of cell in immediate window
debug.print cells(r,c)
next c
next r
end sub

Cheers,
Jason Lepack

On Jan 30, 7:08 am, mcphc wrote:
I use the below to get the vertical edge of the print area.

Range("Print_Area").Address

The output of this is something like "$A$:1$AZ$57".

I would like to run a macro that checks each cell in a row from column "A"
to (as in the above) column "AZ"

I would like to use something like

For col = 1 to 52

How do you represent AZ as 52? Or is there a better way of doing this? (I'm
sure there is)