LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Worksheet Name as argument in Custom Function

Thanks, but sorry to say that made it worse. It doesn't
work with either the string name or a cell reference when
I use the "Evaluate" function.
-----Original Message-----
Use Evaluate for your sheet name parameter:

Function Get_Data(rname, sname, row)
Get_Data = Sheets(Evaluate(sname)).Range(rname).Cells
(row)
End Function

Regards,

Dag Johansen

-----Original Message-----
I created a simple function to retrieve data out of
various one-dimensional ranges. The three arguments
passed are the range name, the worksheet name, and the

row
number. When using this function in a spreadsheet I can
use either "range_name" or a cell reference to a cell
containing that string for the range name, and likewise
can use a number or a reference to a cell containing the
number for the row-number argument, but for the

worksheet
name argument it will let me use "worksheet_name" as a
string, but won't let me use a cell-reference to a cell
containing that string. Have tried several different
times thinking maybe it's a simple syntax error on my
part. Maybe it is but I cannot find it. Here is the
function. Again, whenever I use a cell reference to a
cell containing the worksheet name for the "sname"
argument, it returns #VALUE! Help!, and of course many
thanks!


Function Get_Data(rname, sname, row)
Get_Data = Sheets(sname).Range(rname).Cells(row)
End Function

This works
=Get_Data($C4,"Data_Sheet",$E4)
This doesn't
=Get_Data($C4,$D4,$E4)


.

.

 
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
how to? custom worksheet function using VBA Fred Allen New Users to Excel 4 September 21st 08 12:48 PM
Custom Worksheet Function - Absolute...? Rebecca_SUNY Excel Worksheet Functions 3 November 21st 07 04:46 PM
Automatic evaluation of custom worksheet function Jim Excel Worksheet Functions 1 November 6th 06 10:23 PM
Need Function Argument pasekm Excel Worksheet Functions 4 March 18th 06 11:14 PM
using the name of the worksheet as argument radulucian Excel Worksheet Functions 2 December 6th 05 04:50 PM


All times are GMT +1. The time now is 03:04 AM.

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"