Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default 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 ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default 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 ?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default 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 ?

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
Application Defined or object defined error..?Need help generic er el dee Excel Programming 5 September 10th 09 07:56 PM
Using dcount function within user-defined worksheet function pongthai Excel Programming 3 January 15th 07 09:55 AM
Excel - User Defined Function Error: This function takes no argume BruceInCalgary Excel Programming 3 August 23rd 06 08:53 PM
Need to open the Function Arguments window from VBA for a user defined function. [email protected] Excel Programming 0 June 20th 06 03:53 PM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"