Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
My sub code works fine. But if I turn it into function, it fails. Can I
use a function to get a result from another sheet? What I am doing is to put the function in sheet1, then the function will activate sheet2 where it filters a table and get a sum of a column Thank you |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
do you mean a function used as a formula in a worksheet like
=MyCustomfuction(Sheet2!A1:Z26,3) A function can't activate or select. but most of the time you don't need to. so yes, I would say it can do what you ask, but you will need to clean up your code. -- Regards, Tom Ogilvy "Who I Am" wrote: My sub code works fine. But if I turn it into function, it fails. Can I use a function to get a result from another sheet? What I am doing is to put the function in sheet1, then the function will activate sheet2 where it filters a table and get a sum of a column Thank you |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mr. MVP:
Here is my code. It works. But I have to read the message box and copy it to my spreadsheet. I want to use function to get the result. I put it into Function MonthBillng() End Function But it did not work. (I want to put the function in sheet1 and to get the data from sheet19) ============================================= Sub MonthBilling() Dim TotalBilling Sheet19.Activate ActiveSheet.Range("A4").Select Selection.AutoFilter Field:=7, Criteria1:="<N/A*", Operator:=xlAnd ActiveSheet.Range("M4").Select Range(Selection, Selection.End(xlDown)).Select Selection.SpecialCells(xlCellTypeVisible).Select TotalBilling = Format(WorksheetFunction.Sum(Selection), "$* #,##0") Sheet1.Activate MsgBox TotalBilling End Sub Tom Ogilvy wrote: do you mean a function used as a formula in a worksheet like =MyCustomfuction(Sheet2!A1:Z26,3) A function can't activate or select. but most of the time you don't need to. so yes, I would say it can do what you ask, but you will need to clean up your code. -- Regards, Tom Ogilvy "Who I Am" wrote: My sub code works fine. But if I turn it into function, it fails. Can I use a function to get a result from another sheet? What I am doing is to put the function in sheet1, then the function will activate sheet2 where it filters a table and get a sum of a column Thank you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
use a function for filtered data | Excel Worksheet Functions | |||
How do you copy filtered data to a new sheet? | Excel Discussion (Misc queries) | |||
Updated filtered data on next sheet | Excel Discussion (Misc queries) | |||
Help to sort out filtered data from the data contained in another sheet of the same workbook | Excel Worksheet Functions | |||
Trasnsposing or copying filtered data from one sheet to another | Excel Worksheet Functions |