ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   c.column returns a number - I need an "A" or "B" or... (https://www.excelbanter.com/excel-programming/405302-c-column-returns-number-i-need-b.html)

HH[_3_]

c.column returns a number - I need an "A" or "B" or...
 
Hi'

I write:

top_of_area = 2

for each c in range("C9:L9")
name_of_column = c.column 'HERE I NEED AN ALFABET ANSWER NOT NUMBER
row_number = c.row -1
c.value = "=sum(" & name_of_column & top_of_area & name_of_column &
row_number & ")"
next


This only gives me the number which I cant use when I'm trying to make
at "=sum..." in the cell for later work.

Is there an easyer way?

....or just a working way? :)


Jon Peltier

c.column returns a number - I need an "A" or "B" or...
 
There's probably an easier way, but it's not clear what you're doing
downstream. This quick and dirty formula gives you the column letter:

name_of_column = split(c.address,"$")(1)

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"HH" wrote in message
...
Hi'

I write:

top_of_area = 2

for each c in range("C9:L9")
name_of_column = c.column 'HERE I NEED AN ALFABET ANSWER NOT NUMBER
row_number = c.row -1
c.value = "=sum(" & name_of_column & top_of_area & name_of_column &
row_number & ")"
next


This only gives me the number which I cant use when I'm trying to make
at "=sum..." in the cell for later work.

Is there an easyer way?

...or just a working way? :)




Dave Peterson

c.column returns a number - I need an "A" or "B" or...
 
How about:

activesheet.range("C9:L9").formular1c1 = "=sum(r2c:r[-1]c)"

In R1C1 reference style:
r2c means row 2 of the same column
r[-1]c means the row above the cell of the same column


HH wrote:

Hi'

I write:

top_of_area = 2

for each c in range("C9:L9")
name_of_column = c.column 'HERE I NEED AN ALFABET ANSWER NOT NUMBER
row_number = c.row -1
c.value = "=sum(" & name_of_column & top_of_area & name_of_column &
row_number & ")"
next

This only gives me the number which I cant use when I'm trying to make
at "=sum..." in the cell for later work.

Is there an easyer way?

...or just a working way? :)


--

Dave Peterson


All times are GMT +1. The time now is 03:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com