Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Variable reference

I use the following call to fetch a number from another open spreadsheet.

The call is successful, the FetchWages Function works as expected and
assigns the result to its 3rd Parameter (named wages in the FetchWages
function).

Yet, upon returning, the wnCurWages parameter in the calling program remains
0.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Variable reference

OK, I figured it out myself. A function's return value is its own name.

The following code works...

Public Function FetchWages(emp_code, search_date)

Workbooks("Misthoi.xls").Activate
Worksheets("Data").Activate
evaluate_string = "MATCH(1,(R_CODES=" & emp_code & ")*(R_FROM<=" &
search_date & ")*(R_TO =" & search_date & "),0)"
table_row = Evaluate(evaluate_string)

If IsNumeric(table_row) Then
FetchWages = Application.Index(Range("D_WAGES"), table_row, 7)
Else
FetchWages = 0
End If

End Function

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
how to reference a worksheet with a variable vs a name ibbm Excel Programming 3 April 17th 06 07:53 PM
How to use variable in reference Ming Excel Worksheet Functions 2 July 27th 05 11:24 PM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM
Variable reference John[_44_] Excel Programming 1 August 8th 03 04:53 PM
Using a variable as a row reference? mjmorrison Excel Programming 2 July 14th 03 07:51 PM


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