Seems Easy But Struggling: Macro Trigger

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

Guest

I have a rather easy question (at least it seems easy). Inside my macro
function, how can I get the range or cell that triggered the macro call?

The Application.ActiveCell returns the correct cell position as long as the
user does not move cells after modifying the cell (i.e. the user clicks the
check button between the "X" and "=" button). If the user makes mods and
hits enter, then Application.ActiveCell returns the cell below the modified
cell. Or, if the user hits tab, then Application.ActiveCell returns the cell
to the right of the modified cell.

Thanks in advance,
-Fabricio
(e-mail address removed)
 
If you mean one of the worksheet events, then you should have Target as an
argument, which is the cell changed or selected.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
ARe you firing your macor off of the change event? if so then the aregument
target in the procedure is the cell that was changed. It is a range object
that you cna use much like activecell.

HTH
 
Bob and Jim,

I was trying to get the Target range from within a macro function like so:

Public Function MyMac() as String
Dim Target as Range
Target = Application.ActiveCell
End Function

However, the suggestion you both gave on using the Change Event (with the
Target range as an argument) works better.

Much appreciate the great help. Thanks!

-Fabricio
(e-mail address removed)
 

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