ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Columncount (https://www.excelbanter.com/excel-programming/282838-columncount.html)

Christian Davidsson[_2_]

Columncount
 
Hello,

I'm sure this is pretty easy, but my brain has just locked down - and I
can't figure it out.

I need to find the column count based on ActiveCell. If ActiveCell is in the
D column, the result should be 4, coloumn C should be 3 etc.

I'm using this value in as a parameter for some calculations later on in the
code. Currently - I'm using "colCount = ActiveCell.Columns.Count" but this
only returns the value 1.

Any help would be appriciated.


Thanks in advance,
Christian Davidsson



RADO[_3_]

Columncount
 
try ActiveCell.Column

RADO


"Christian Davidsson" <christian[DOT]davidsson[AT]skanemejerier[DOT]se
wrote in message ...
Hello,

I'm sure this is pretty easy, but my brain has just locked down - and I
can't figure it out.

I need to find the column count based on ActiveCell. If ActiveCell is in

the
D column, the result should be 4, coloumn C should be 3 etc.

I'm using this value in as a parameter for some calculations later on in

the
code. Currently - I'm using "colCount = ActiveCell.Columns.Count" but this
only returns the value 1.

Any help would be appriciated.


Thanks in advance,
Christian Davidsson





Christian Davidsson[_2_]

Columncount
 
Hi Rado,

ActiveCell.Column gives me the value of the ActiveCell contents. I need the
actual column count (col A = 1, B = 2, C = 3, D = 4 ... Z = 24 etc. etc.)
based on the amount of columns to the left of the currnet cell.

Ragards,
Christian Davidsson


"RADO" skrev i meddelandet
...
try ActiveCell.Column

RADO


"Christian Davidsson" <christian[DOT]davidsson[AT]skanemejerier[DOT]se
wrote in message ...
Hello,

I'm sure this is pretty easy, but my brain has just locked down - and I
can't figure it out.

I need to find the column count based on ActiveCell. If ActiveCell is in

the
D column, the result should be 4, coloumn C should be 3 etc.

I'm using this value in as a parameter for some calculations later on in

the
code. Currently - I'm using "colCount = ActiveCell.Columns.Count" but

this
only returns the value 1.

Any help would be appriciated.


Thanks in advance,
Christian Davidsson







Christian Davidsson[_2_]

Columncount
 
Never mind my other post - I wrote ActiveCell.Columns (with an S on the end)
which caused it to return the value of the cell.

Thanks you very much for your help! It works just like it was supposed to
do.


Best regards,
Christian Davidsson

"RADO" skrev i meddelandet
...
try ActiveCell.Column

RADO


"Christian Davidsson" <christian[DOT]davidsson[AT]skanemejerier[DOT]se
wrote in message ...
Hello,

I'm sure this is pretty easy, but my brain has just locked down - and I
can't figure it out.

I need to find the column count based on ActiveCell. If ActiveCell is in

the
D column, the result should be 4, coloumn C should be 3 etc.

I'm using this value in as a parameter for some calculations later on in

the
code. Currently - I'm using "colCount = ActiveCell.Columns.Count" but

this
only returns the value 1.

Any help would be appriciated.


Thanks in advance,
Christian Davidsson








All times are GMT +1. The time now is 11:59 PM.

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