Get the "address" or coordinates of a cell in excel...

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

Get the "address" or coordinates of a cell in excel...

Post by rjw524 » Fri Jan 29, 2016 9:33 pm

Hi All,

Quick question...(this problem can't be as hard as it's turning out to be, right?)

Let's say you perform a copy command of a cell on a specific sheet of an excel workbook.

Is there some kind of way in MS14 to get and store the address or coordinates of the copied cell as a variable for later reference?

(I honestly thought this would be cake, but I scoured the forum for about 90 minutes and found nothing to suited my needs. I must be asking it the wrong way because I would think this is a routine exercise for a macro.)

Thanks,

R.J.

rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

Re: Get the "address" or coordinates of a cell in excel...

Post by rjw524 » Fri Jan 29, 2016 9:47 pm

Please disregard this post unless you want to keep it up for others who may ask. Or flag it as "Solved".

I must be getting punchy. I looked through the forums again and found this almost instantly.

(*Many thanks to JRL and hagchr who both presented options that worked. Below is hagchr's code...)

Code: Select all

VBSTART
Dim objExcel
Sub GetExcel
    Set objExcel = GetObject( , "Excel.Application")
End Sub
VBEND
  
VBRun>GetExcel
VBEval>objExcel.ActiveSheet.Name,Sheet
VBEval>objExcel.ActiveCell.Address,Cell
MessageModal>Sheet: %Sheet%%CRLF%Cell: %Cell%
Works exquisitely...

User avatar
Phil Pendlebury
Automation Wizard
Posts: 543
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Re: Get the "address" or coordinates of a cell in excel...

Post by Phil Pendlebury » Sun Jan 31, 2016 6:20 am

Vey useful info. Thanks for posting.
Phil Pendlebury - Linktree

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts