#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default functions

Can a Function call a macro? Say during a sort or lookup opperation you want
some special data that the macro returns?

Kevin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default functions

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default functions

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default functions

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default functions

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default functions

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

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
Multiple functions, conditional functions HeatherBelle Excel Worksheet Functions 7 October 17th 08 03:57 PM
How to convert cell formula functions to code functions Adnan Excel Discussion (Misc queries) 1 October 1st 08 08:30 PM
efficiency: database functions vs. math functions vs. array formula nickname Excel Discussion (Misc queries) 2 July 14th 06 04:26 AM
Nesting functions in the functions dialog box cs170a Excel Worksheet Functions 0 June 10th 05 10:36 PM
excel functions and User defined functions Kanan Excel Programming 4 May 20th 04 11:21 PM


All times are GMT +1. The time now is 12:33 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"