From: Gary''s Student on 15 May 2010 08:11 An interesting request! This little macro enters the function in the active cell. It then uses SendKeys to enter Edit Mode and move the cursor betweeen the parens: Sub FormulaStarter() Dim r As Range Set r = ActiveCell r.Formula = "=mysub()" Application.SendKeys "{F2}" Application.SendKeys "{LEFT}" DoEvents End Sub -- Gary''s Student - gsnu201003 "Subodh" wrote: > I have a function named mysub and with parameters that has to be > supplied to the function. > I want that when the cell where the function is to be inserted, the > user can type the arguments of the > function sub after they have run the sub. Lets say, that after the sub > is run, they get =mysub(..) with the > cursor in between the parenthesis and so that they can move with > typing of the arguments/parameter of the > function. > So, in summary, the advantage is that, the user should not type =mysub > through the keyboard > or they donot even need to remember that provied that there are large > number of such functions. > Thanks for your response. > . >
From: Gary''s Student on 15 May 2010 08:12 Sub FormulaStarter() Dim r As Range Set r = ActiveCell r.Formula = "=mysub()" Application.SendKeys "{F2}" Application.SendKeys "{LEFT}" DoEvents End Sub -- Gary''s Student - gsnu201003
From: Subodh on 15 May 2010 09:33 On May 15, 5:11 pm, Gary''s Student <GarysStud...(a)discussions.microsoft.com> wrote: > An interesting request! > > This little macro enters the function in the active cell. It then uses > SendKeys to enter Edit Mode and move the cursor betweeen the parens: > > Sub FormulaStarter() > Dim r As Range > Set r = ActiveCell > r.Formula = "=mysub()" > Application.SendKeys "{F2}" > Application.SendKeys "{LEFT}" > DoEvents > End Sub > > -- > Gary''s Student - gsnu201003 > > > > "Subodh" wrote: > > I have a function named mysub and with parameters that has to be > > supplied to the function. > > I want that when the cell where the function is to be inserted, the > > user can type the arguments of the > > function sub after they have run the sub. Lets say, that after the sub > > is run, they get =mysub(..) with the > > cursor in between the parenthesis and so that they can move with > > typing of the arguments/parameter of the > > function. > > So, in summary, the advantage is that, the user should not type =mysub > > through the keyboard > > or they donot even need to remember that provied that there are large > > number of such functions. > > Thanks for your response. > > .- Hide quoted text - > > - Show quoted text - Thanks Gary's It worked as i had expected. Thanks a lot.
|
Pages: 1 Prev: Changes to working code Next: Insert a custom function in a cell by runnig a sub or through |