Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default help! function not obtaining cell values

The name of the ****ion is calcsoilpress but inside the function you're
referencing calsoilpress -- the names much match exactly -- the "c" is
missing!
"maweilian" wrote in message
...
Newbie question:

The simple VBA function below is not working. It is called by the
following
in the spreadsheet:
=calcsoilpress(D9,D10,'Soil Data'!D7,'Soil Data'!E7,D17)

(note: "Soil Data" is another worksheet in the same xls file)

When I add a breakpoint at the first "If-Then" line and examine the value
of
the variables, I discovered that some of the parameters had a value of
zero.
But the value of the cells are not zero! What is happening here?

Thanks in advance for any help!

Will

See code below:


Public Function calcsoilpress(soiltop As Double, soilbottom As Double,
soilwtdensitydry As Double, soilwtdensitywet As Double, waterdepth As
Double)

If waterdepth <= soiltop Then
calsoilpress = (soilbottom - soiltop) * soilwtdensitywet
End If

If waterdepth = soilbot Then
calsoilpress = (soilbottom - soiltop) * soilwtdensitydry
End If

If waterdepth soiltop And waterdepth < soilbot Then
calsoilpress = ((soilbottom - waterdepth) * soilwtdensitywet) +
((waterdepth - soiltop) * soilwtdensitydry)
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
Obtaining the minimum of values which have been generated by a for Caithness Girl New Users to Excel 6 November 18th 09 05:01 PM
Obtaining values for a cell in Excel from a separate Excel file Purtec1 Excel Discussion (Misc queries) 2 October 9th 06 07:52 PM
Obtaining cell reference from index function MH UK Excel Programming 3 February 22nd 06 01:58 PM
Obtaining Max and Min Values with Sumproduct Timmy Mac1 Excel Discussion (Misc queries) 2 October 20th 05 05:33 PM
Obtaining column/row numbers of cells in user defined function GreenInIowa Excel Programming 6 October 19th 05 09:20 PM


All times are GMT +1. The time now is 06:00 AM.

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"