Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks everyone for the help... I thought you might like to know that I
solved it... I guess its been a long day of coding...but I had CSVCICAvg Dimmed as Integer rather than Double and it was rounding to zeros... Sorry about that, but thanks for the help! "Vergel Adriano" wrote: WorksheetFunction is a member of the Application object. Try: CSVCICAvg = xlApp.WorksheetFunction.Average(LCV.Range("I3:I" & (c + 2))) where xlApp is a variable that holds the application object. If you don't have a variable for the application, try: CSVCICAvg = LCV.Application.WorksheetFunction.Average(LCV.Rang e("I3:I" & (c + 2))) -- Hope that helps. Vergel Adriano "NewToVB" wrote: Thanks for the comments. LCV is my excel worksheet, I'm using Visual Studio (Visual Basic) rather than VBA. I have to have LCV in front to tell it which sheet. I have LCV.Range in several other places in my code and it works fine, but I think I must be coding the Average Function wrong. You can average a range right? I don't know why I'd be getting all zeros. "Tom Ogilvy" wrote: I don't know what LCV is a reference to, but I suspect LCV.Range doesn't point where you think it does or LCV.Range is blank or LCV.Range doesn't contain any numbers (or contains numbers that are stored as text strings). if you try using Average in a cell going against the range you want averaged and get a valid answer, then you can disregard the stored as strings. -- Regards, Tom Ogilvy "NewToVB" wrote: I'm trying to average I3:I & c + 2 but I keep getting zeros. Any ideas why? CSVCICAvg = LCV.WorksheetFunction.Average(LCV.Range("I3:I" & (c + 2))) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
AVERAGE a range in a column if another column's range equals a val | Excel Discussion (Misc queries) | |||
Zero in Average problem | Excel Discussion (Misc queries) | |||
Problem with average | Excel Discussion (Misc queries) | |||
Average Problem | Excel Worksheet Functions | |||
AVERAGE problem | Excel Worksheet Functions |