Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default STDEV function in VB scritp for excel

I am writing a VB script in excel and I am trying to use the STDEV function.
I have worked through several errors but I am stumped on this last one:

"Run time error 1004
Unable to get the StDev property of the Worksheetfunction class."

I am a novice at VB so any help would be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 837
Default STDEV function in VB scritp for excel

VB (standalone language) or VBA (supplied with Excel)?
What version of Excel?
Post your code.

In very old versions of Excel (pre Excel97, & possibly Excel97 as well), you
would need to use Application.StDev() instead of WorksheetFunction.StDev()

Jerry

"dbwells" wrote:

I am writing a VB script in excel and I am trying to use the STDEV function.
I have worked through several errors but I am stumped on this last one:

"Run time error 1004
Unable to get the StDev property of the Worksheetfunction class."

I am a novice at VB so any help would be appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default STDEV function in VB scritp for excel


Yes VBA Supplied with Excel
Excel 2002 sp3
application.stdev() does work.
Sheets("Sheet1").Cells(Nrow, 3).Value = Application.StDev("D" & Srow & ":D"
& Erow - 1)

Nrow is the row number of the summary worksheet.
Srow is the starting row of the number group.
Erow - 1 is the end row of the number group.
Erow is the row number of the next number group.

I now get a #VALUE! on the summary worksheet but this is a lot further than
I was getting before.

thanks for your help.

"Jerry W. Lewis" wrote:

VB (standalone language) or VBA (supplied with Excel)?
What version of Excel?
Post your code.

In very old versions of Excel (pre Excel97, & possibly Excel97 as well), you
would need to use Application.StDev() instead of WorksheetFunction.StDev()

Jerry

"dbwells" wrote:

I am writing a VB script in excel and I am trying to use the STDEV function.
I have worked through several errors but I am stumped on this last one:

"Run time error 1004
Unable to get the StDev property of the Worksheetfunction class."

I am a novice at VB so any help would be appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 837
Default STDEV function in VB scritp for excel

Your code produces errors because it does the equivalent of using
=STDEV("D5:D6")
instead of
=STDEV(D5:D6)
The arguments to STDEV must be numbers, arrays, or ranges, not strings. Try
StDev(Range("D" & Srow & ":D" & Erow - 1))
with either Application or WorksheetFunction as the prefix. Excel 2002
supports both prefixes, but WorksheetFunction has advantages so long as you
do not need the code to run in old versions of Excel.

Jerry

"dbwells" wrote:


Yes VBA Supplied with Excel
Excel 2002 sp3
application.stdev() does work.
Sheets("Sheet1").Cells(Nrow, 3).Value = Application.StDev("D" & Srow & ":D"
& Erow - 1)

Nrow is the row number of the summary worksheet.
Srow is the starting row of the number group.
Erow - 1 is the end row of the number group.
Erow is the row number of the next number group.

I now get a #VALUE! on the summary worksheet but this is a lot further than
I was getting before.

thanks for your help.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default STDEV function in VB scritp for excel

What if all I want to do is copy or use an existing VBA 6.5 file (with old
data) in Excel 2003 into a new file to be able to enter new current data into
the new file?

In a new file which I copied from the old Excel 2003 VBA 6.5 file I used
Clear Contents to delete all data but the first two lines as sample data but
now get "Run-time error '1004': "Unable to get the Match property of the
WorksheetFunction class".

I double-checked the VBA code on the prior file - all is the same - is it
the range? I updated the range but that didn't work either.

"Jerry W. Lewis" wrote:

Your code produces errors because it does the equivalent of using
=STDEV("D5:D6")
instead of
=STDEV(D5:D6)
The arguments to STDEV must be numbers, arrays, or ranges, not strings. Try
StDev(Range("D" & Srow & ":D" & Erow - 1))
with either Application or WorksheetFunction as the prefix. Excel 2002
supports both prefixes, but WorksheetFunction has advantages so long as you
do not need the code to run in old versions of Excel.

Jerry

"dbwells" wrote:


Yes VBA Supplied with Excel
Excel 2002 sp3
application.stdev() does work.
Sheets("Sheet1").Cells(Nrow, 3).Value = Application.StDev("D" & Srow & ":D"
& Erow - 1)

Nrow is the row number of the summary worksheet.
Srow is the starting row of the number group.
Erow - 1 is the end row of the number group.
Erow is the row number of the next number group.

I now get a #VALUE! on the summary worksheet but this is a lot further than
I was getting before.

thanks for your help.



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 do I run the STDEV function with multiple criteria? JLMcCracken Excel Worksheet Functions 1 August 12th 06 07:45 PM
Stdev function error! Martin Excel Discussion (Misc queries) 0 April 26th 06 07:02 AM
STDEV Kimo Excel Discussion (Misc queries) 3 January 13th 06 02:51 PM
Rounding error in Stdev function result. David K Excel Worksheet Functions 15 January 12th 06 04:19 AM
STDEV...HELP JRH New Users to Excel 5 January 22nd 05 08:47 PM


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