![]() |
generic use of sheet name in user-defined function
I have a workbook that has a separate sheet for each employee. I need to
write a function that sums certain cells based on meeting certain criteria for each employee. The layout of each employees sheet is identical. How can I write the function so it will generically use the sheet name in the forumla as opposed to having to spell it out ? |
generic use of sheet name in user-defined function
This should give you the idea:
Public function demo_udf(byval ws as string) demo_udf = worksheets(ws).range("A1").value end function If you type "Sheet1" in cell A1 on Sheet2, the put =demo_udf(A1) in B1 on the same sheet it will return the value of A1 on Sheet1. Sam "Eric_in_EVV" wrote: I have a workbook that has a separate sheet for each employee. I need to write a function that sums certain cells based on meeting certain criteria for each employee. The layout of each employees sheet is identical. How can I write the function so it will generically use the sheet name in the forumla as opposed to having to spell it out ? |
generic use of sheet name in user-defined function
I'm sure about the question
so if emplyee is the string variable containg the emplyees name or ID, you're saying that its also the sheet name for that employee? function emp_data(employee as string) with workhseets(employee) 'do something end with end function "Eric_in_EVV" wrote: I have a workbook that has a separate sheet for each employee. I need to write a function that sums certain cells based on meeting certain criteria for each employee. The layout of each employees sheet is identical. How can I write the function so it will generically use the sheet name in the forumla as opposed to having to spell it out ? |
All times are GMT +1. The time now is 01:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com