Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Obtaining the minimum of values which have been generated by a for | New Users to Excel | |||
Obtaining values for a cell in Excel from a separate Excel file | Excel Discussion (Misc queries) | |||
Obtaining cell reference from index function | Excel Programming | |||
Obtaining Max and Min Values with Sumproduct | Excel Discussion (Misc queries) | |||
Obtaining column/row numbers of cells in user defined function | Excel Programming |