Find ActiveCell.column

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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).Value
 
to be precise
sValue = Worksheets("sheet1").Cells(1,ActiveCell.Column).Value
should be

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top