Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default How do I get this VB Call to work?

I have the following call to a VB Subroutine in my code:
=Gen_Note(A7)

The only way I can get it to execute is to that I move my cursor to the
particlar cell, hit the left mouse key
twice, and hit return to calculate.

I've tried copying the call into another line; that doesn't force it to make
a call. <F9 doesn't get it to calculate either.

What can I do?

Thanks for your help,
Mac



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I get this VB Call to work?

I missed where you said you tried application.Volatile as the first line of
the function. I know you discussed this with Jerry Lewis, so I don't know
if that is something you have tried or not. You can do a full recalc with
Ctrl+Alt+F9

Another problem is that the function may result in an error if it isn't in
the active cell - However, I would think you would get a #Value result in
that case although I can't say for sure.

--
Regards,
Tom Ogilvy

"Mac Lingo" wrote in message
hlink.net...
I have the following call to a VB Subroutine in my code:
=Gen_Note(A7)

The only way I can get it to execute is to that I move my cursor to the
particlar cell, hit the left mouse key
twice, and hit return to calculate.

I've tried copying the call into another line; that doesn't force it to

make
a call. <F9 doesn't get it to calculate either.

What can I do?

Thanks for your help,
Mac





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default How do I get this VB Call to work?

The problem is that there is difference between the Active Cell and the
Calling Cell.

When you copy cells, the Active Cell seems to stay constant for every call.

Use
Calling_Address = Application.Caller.Address

to figure out the actual calling address.

Mac


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I get this VB Call to work?

Guess you missed the point Mac.

I am well aware of application.caller. That says nothing for how your code
is written, however. I suggested that a possible problem is that your
function may only work when evaluated as the activecell. It is just a guess
as you have faithfully hidden any nuance of your function. I imagine you
will figure it out eventually.

--
Regards,
Tom Ogilvy

"Mac Lingo" wrote in message
hlink.net...
The problem is that there is difference between the Active Cell and the
Calling Cell.

When you copy cells, the Active Cell seems to stay constant for every

call.

Use
Calling_Address = Application.Caller.Address

to figure out the actual calling address.

Mac




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default How do I get this VB Call to work?

Yes, you're right, Tom; the function only evaluates when called from the
active cell.

My problem is that I need to know the row number that the function is being
processed for, and I apparently only know how to get the row number of the
active cell.

One solution I can think of would be to move the whole process into a macro
and take over row control explicitly.

But is there a way to figure out the row number from the function? It make
the coding much cleaner to do it this way.

Thanks,
Mac Lingo




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do I get this VB Call to work?

you show yourself how to do that

Application.Caller returns the address of the cell containing the formula.
so just get the row of that cell

Public Function MyFunction()
Application.Volatile
Dim rng1 as Range
set rng1 = Application.Caller
MyFunction = "I am located in row " & rng1.row
End Function

This should update each time the sheet calculates.

--
Regards,
Tom Ogilvy



"Mac Lingo" wrote in message
hlink.net...
Yes, you're right, Tom; the function only evaluates when called from the
active cell.

My problem is that I need to know the row number that the function is

being
processed for, and I apparently only know how to get the row number of the
active cell.

One solution I can think of would be to move the whole process into a

macro
and take over row control explicitly.

But is there a way to figure out the row number from the function? It

make
the coding much cleaner to do it this way.

Thanks,
Mac Lingo




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I'm not sure what you'd call it, but is it possible to do this? nut_mom Excel Discussion (Misc queries) 3 June 28th 06 06:17 PM
Call Center Management: How to calculate 'cost per call' Denniso6 Excel Discussion (Misc queries) 2 June 25th 06 05:01 PM
total work hours for 24 hour on-call schedules Kate Excel Discussion (Misc queries) 1 February 7th 06 03:01 AM
Don't know what to call what I need? chanwando Excel Worksheet Functions 5 September 9th 05 10:01 PM
call sub Claudia Dell'Era[_2_] Excel Programming 3 October 3rd 03 01:31 PM


All times are GMT +1. The time now is 09:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"