Can a Function call a macro? Say during a sort or lookup opperation you want
some special data that the macro returns?
Kevin
Can a Function call a macro? Say during a sort or lookup opperation you want
some special data that the macro returns?
Kevin
If you convert your macro to a function then a function can call another
function.
Although there are many exceptions: a macro does something and a function
returns a value. So a function looking for information would be expected to
call another function.
"Kanaski79" wrote:
> Can a Function call a macro? Say during a sort or lookup opperation you want
> some special data that the macro returns?
>
> Kevin
Don't know if you saw my other post, but it was about finding out how many
cells a merged cell group occupies. I need that number from the macro that
someone responded with to use that as the range for the lookup and max
functions. Do you think that would work?
this was the macro they gave me.
Sub test()
ActiveCell.Value = Format(Date, "dd-mmm-yyyy")
End Sub
Thanks
Kevin
"Vacation's Over" wrote:
> If you convert your macro to a function then a function can call another
> function.
>
> Although there are many exceptions: a macro does something and a function
> returns a value. So a function looking for information would be expected to
> call another function.
>
> "Kanaski79" wrote:
>
> > Can a Function call a macro? Say during a sort or lookup opperation you want
> > some special data that the macro returns?
> >
> > Kevin
User defined functions:
Create your own function simply by using Function instead of Sub. Then set
your function = value you require
Function MergeCount(Cellref as range) as Integer
Mergecount = Range("A4").MergeArea.Cells.Count
End Function
then in a cell
= MergeCount(A5)
"Kanaski79" wrote:
> Don't know if you saw my other post, but it was about finding out how many
> cells a merged cell group occupies. I need that number from the macro that
> someone responded with to use that as the range for the lookup and max
> functions. Do you think that would work?
>
> this was the macro they gave me.
>
> Sub test()
> ActiveCell.Value = Format(Date, "dd-mmm-yyyy")
> End Sub
>
> Thanks
>
> Kevin
>
> "Vacation's Over" wrote:
>
> > If you convert your macro to a function then a function can call another
> > function.
> >
> > Although there are many exceptions: a macro does something and a function
> > returns a value. So a function looking for information would be expected to
> > call another function.
> >
> > "Kanaski79" wrote:
> >
> > > Can a Function call a macro? Say during a sort or lookup opperation you want
> > > some special data that the macro returns?
> > >
> > > Kevin
Ok this may sound like s stupid question. Where do you enter all this code?
I do have some programming experience but I have never written anything for
excell. Never needed to untill now. Small example would be greatly helpfull.
Thanks again
Kevin
"Vacation's Over" wrote:
> User defined functions:
> Create your own function simply by using Function instead of Sub. Then set
> your function = value you require
>
> Function MergeCount(Cellref as range) as Integer
>
> Mergecount = Range("A4").MergeArea.Cells.Count
>
> End Function
>
> then in a cell
> = MergeCount(A5)
>
> "Kanaski79" wrote:
>
> > Don't know if you saw my other post, but it was about finding out how many
> > cells a merged cell group occupies. I need that number from the macro that
> > someone responded with to use that as the range for the lookup and max
> > functions. Do you think that would work?
> >
> > this was the macro they gave me.
> >
> > Sub test()
> > ActiveCell.Value = Format(Date, "dd-mmm-yyyy")
> > End Sub
> >
> > Thanks
> >
> > Kevin
> >
> > "Vacation's Over" wrote:
> >
> > > If you convert your macro to a function then a function can call another
> > > function.
> > >
> > > Although there are many exceptions: a macro does something and a function
> > > returns a value. So a function looking for information would be expected to
> > > call another function.
> > >
> > > "Kanaski79" wrote:
> > >
> > > > Can a Function call a macro? Say during a sort or lookup opperation you want
> > > > some special data that the macro returns?
> > > >
> > > > Kevin
Yea, it's kind of weird. Ever since Excel 5.0 back in the early 90's VBA has
been "easily" accessable from Excel. But, as you point out it is just a bit
hidden.
If you dare to see how deep the rabbit hole goes.....
click on a cell then hold alt and hit F11
You are now in the VBE - Visual Basic Editor and can see any code attached
to your workbook
And you should read a good book .....Google - j Walk (worked for me...)
"Kanaski79" wrote:
> Ok this may sound like s stupid question. Where do you enter all this code?
> I do have some programming experience but I have never written anything for
> excell. Never needed to untill now. Small example would be greatly helpfull.
>
> Thanks again
>
> Kevin
>
> "Vacation's Over" wrote:
>
> > User defined functions:
> > Create your own function simply by using Function instead of Sub. Then set
> > your function = value you require
> >
> > Function MergeCount(Cellref as range) as Integer
> >
> > Mergecount = Range("A4").MergeArea.Cells.Count
> >
> > End Function
> >
> > then in a cell
> > = MergeCount(A5)
> >
> > "Kanaski79" wrote:
> >
> > > Don't know if you saw my other post, but it was about finding out how many
> > > cells a merged cell group occupies. I need that number from the macro that
> > > someone responded with to use that as the range for the lookup and max
> > > functions. Do you think that would work?
> > >
> > > this was the macro they gave me.
> > >
> > > Sub test()
> > > ActiveCell.Value = Format(Date, "dd-mmm-yyyy")
> > > End Sub
> > >
> > > Thanks
> > >
> > > Kevin
> > >
> > > "Vacation's Over" wrote:
> > >
> > > > If you convert your macro to a function then a function can call another
> > > > function.
> > > >
> > > > Although there are many exceptions: a macro does something and a function
> > > > returns a value. So a function looking for information would be expected to
> > > > call another function.
> > > >
> > > > "Kanaski79" wrote:
> > > >
> > > > > Can a Function call a macro? Say during a sort or lookup opperation you want
> > > > > some special data that the macro returns?
> > > > >
> > > > > Kevin
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks