View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Barnes Bob Barnes is offline
external usenet poster
 
Posts: 134
Default Code to get ActiveCell to start a Subroutine


Peter T - Sorry you don't understand what I said. Some others here did. I
thank you for your Input.

I turned it over to Mgmt today, and they loved it.

Thank you again, Bob

"Peter T" wrote:

That's very good advice. If you recall, I had also told you I doubt you want
the ActiveCell. I wasn't sure though as I didn't understand what you were
trying to do. At the risk of repeating myself, you may get a more useful
answer if you explain your objective in words, not your code which is highly
ambiguous.

Regards,
Peter T


"Bob Barnes" wrote in message
...
It works !! Thank you.

Yesterday, I read this...

I would strongly recommend that you not use ActiveCell in any
calculation, because you cannot predict where the active cell will be,
let alone what worksheet and workbook might be active when Excel
decides that it is time to calculate. If you need to get a reference
to the cell in which the function was called, use either
Application.Caller or Application.ThisCell. These will return a Range
object to points to the cell in which the function was called.

Your thoughts on that? I don't know, but
Dim t As Range
Set t = ActiveCell


...is working. Thanks again, Bob

"JLGWhiz" wrote:

Dim t As Range
Set t = ActiveCell


"Bob Barnes" wrote in message
...
I had 2 other threads here yesterday and found answers, but we still
need.
Need to code for the ActiveCell in the 1st line of
Private Sub SeeDiff() .. below.

TIA - Bob

Snippets from the 2 other threads from yesterday...
I'm going to run this code in Workbook_Open instead of Worksheet_Change
(it
does work in Worksheet_Change). We've decided the Excel file will be
essentially only a "snapshot" as all data will be maintained in the
Access
Database.

So..Workbook_open will include code for each of the 72 Cells, IE...
Range("DNine").Select
Call SeeDiff
Range("ENine").Select
Call SeeDiff
....

Private Sub SeeDiff()
Set t = Application.Caller <---No "Target" here...how do I set the
"ActiveCell"?
....I tried Application.Caller & Application.ThisCell suggested in this
thread by Chip...
...but that didn't work............................