ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find ActiveCell.column (https://www.excelbanter.com/excel-programming/316346-find-activecell-column.html)

lindamac

Find ActiveCell.column
 
When I use the Activecell.column statement it returns a numeric value for the
column(ex: 27), I want the character value (ex: AA).

Here is a sample of my code, I always want to access row #1, but the column
will vary based on the activecell location:

Dim sColumn as string
Dim sRangeName as string
Dim sValue as string

sColumn = activecell.column
sRangeName = sColumn + "1"
sValue = worksheets("sheet1").range(sRangeName).value




Frank Kabel

Find ActiveCell.column
 
Hi
just a question: For what do you need this?

--
Regards
Frank Kabel
Frankfurt, Germany

"LindaMac" schrieb im Newsbeitrag
...
When I use the Activecell.column statement it returns a numeric value

for the
column(ex: 27), I want the character value (ex: AA).

Here is a sample of my code, I always want to access row #1, but the

column
will vary based on the activecell location:

Dim sColumn as string
Dim sRangeName as string
Dim sValue as string

sColumn = activecell.column
sRangeName = sColumn + "1"
sValue = worksheets("sheet1").range(sRangeName).value





Dick Kusleika[_4_]

Find ActiveCell.column
 
Linda

See here

http://www.dicks-blog.com/excel/2004..._numbers_.html to convert
column numbers to letter.

For your situation, you might use the Cells method

sValue = Worksheets("sheet1").Cells(1,ActiveCell.Column).Va lue

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"LindaMac" wrote in message
...
When I use the Activecell.column statement it returns a numeric value for

the
column(ex: 27), I want the character value (ex: AA).

Here is a sample of my code, I always want to access row #1, but the

column
will vary based on the activecell location:

Dim sColumn as string
Dim sRangeName as string
Dim sValue as string

sColumn = activecell.column
sRangeName = sColumn + "1"
sValue = worksheets("sheet1").range(sRangeName).value






Tom Ogilvy

Find ActiveCell.column
 
That would be the hard way to do it


Dim lColumn as long
Dim sValue as string

lColumn = activecell.column
sValue = worksheets("sheet1").Cells(1, lColumn + 1).value


or

sValue = Worksheets("sheet1").Cells(1,ActiveCell.Column).Va lue

--
Regards,
Tom Ogilvy


"LindaMac" wrote in message
...
When I use the Activecell.column statement it returns a numeric value for

the
column(ex: 27), I want the character value (ex: AA).

Here is a sample of my code, I always want to access row #1, but the

column
will vary based on the activecell location:

Dim sColumn as string
Dim sRangeName as string
Dim sValue as string

sColumn = activecell.column
sRangeName = sColumn + "1"
sValue = worksheets("sheet1").range(sRangeName).value






Tom Ogilvy

Find ActiveCell.column
 
to be precise
sValue = Worksheets("sheet1").Cells(1,ActiveCell.Column).Va lue
should be

sValue = Worksheets("sheet1").Cells(1,ActiveCell.Column + 1).Value

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
That would be the hard way to do it


Dim lColumn as long
Dim sValue as string

lColumn = activecell.column
sValue = worksheets("sheet1").Cells(1, lColumn + 1).value


or

sValue = Worksheets("sheet1").Cells(1,ActiveCell.Column).Va lue

--
Regards,
Tom Ogilvy


"LindaMac" wrote in message
...
When I use the Activecell.column statement it returns a numeric value

for
the
column(ex: 27), I want the character value (ex: AA).

Here is a sample of my code, I always want to access row #1, but the

column
will vary based on the activecell location:

Dim sColumn as string
Dim sRangeName as string
Dim sValue as string

sColumn = activecell.column
sRangeName = sColumn + "1"
sValue = worksheets("sheet1").range(sRangeName).value









All times are GMT +1. The time now is 07:56 AM.

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