retrieve Active cell "Name" vbscript

L

Lee

I'm not sure if this is the right group or not,

I have a vbscript that opens and excel spreadsheet and does some work on it.

I need to be able to add a formula to a cell like "=A1+A2" , but I need to
know which cell I am in in order to add the formula

I know objXL.activeSheet.Range("A1").activate will point me to cell "A1".
then I move down through the sheet. using
objXL.activecell.offset(1,0).activate which moves me down a row,

what I really need is a way to find out "where I am" after the script moves.

is there a function that will return "B1" when I'm on the second row?
 
P

Pegasus \(MVP\)

Lee said:
I'm not sure if this is the right group or not,

I have a vbscript that opens and excel spreadsheet and does some work on
it.

I need to be able to add a formula to a cell like "=A1+A2" , but I need to
know which cell I am in in order to add the formula

I know objXL.activeSheet.Range("A1").activate will point me to cell
"A1".
then I move down through the sheet. using
objXL.activecell.offset(1,0).activate which moves me down a row,

what I really need is a way to find out "where I am" after the script
moves.

is there a function that will return "B1" when I'm on the second row?

If I recall correctly then objExcel.ActiveCell.Address will return the
current cell address.
 
C

Chip Pearson

ActiveCell refers to the current active cell, wherever it might be.
ActiveCell.Address returns a string containing the address of the
ActiveCell.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

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

Top