Insert a function through a command button
On May 12, 7:25*pm, Subodh wrote:
On May 12, 6:21*pm, "Bob Phillips" wrote:
If the parameter cell is selected, what is the target cell (for the
formula)?
And can you be sure some other cell won't get selected?
--
HTH
Bob
"Subodh" wrote in message
...
On May 12, 1:57 pm, "Bob Phillips" wrote:
I did something similar to this. The problem is that you can't have your
code inserting and the user interacting as Excel does natively, so what I
did was to throw up a dialog asking the user to select the cell to be
included, using Application.Inputbox(...Type:=8) and then get that cell
address and inject it into my string, and return the string from the
function.
--
HTH
Bob
"Subodh" wrote in message
....
I have custom function created in VBA.
I want to use the button to insert the function.
I tried to accomplish is something like inserting the Sum function by
clicking the button so that =sum() appears in the cell and i can type
the number/parameters required.
But, when i tried to do that using a macro recorder then it cannot be
done
Any help would be appreciated.
Thanks in advance.- Hide quoted text -
- Show quoted text -
I think in my case, application.inputbox is not needed.
Coz, the desired cell is already selected So, its very easy to get
that cell address.
So, I only need to get a way to inject the cell address to the string
to use the function, i hope
that it would be possible.
Thanks for your prompt response.- Hide quoted text -
- Show quoted text -
I want to insert the function in the cell that is selected.
So, in my opinion the selected cell itself is the target cell
Or, let me explain again what i need to do.
I have to insert my custom function lets say mysub() in the selected
cell A1
Now, I have selected the cell A1
My funciton has one argument (and the agrument is not optional)
So, when i click on the button, and then run the macro,
I should be able to get in the selected cell something like
="=mysub(..)"
with the cursor in between the parenthesis. Like the one we get when
we click the appropriate buttom for the sum function as an example.
Thanks for your concern.- Hide quoted text -
- Show quoted text -
I didn't thought it was a difficult problem,
but i don't know if it was because i couldn't explain the case or my
question properly or
that it was really a difficult problem??
|