Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default using Frequency in Excel 2002 VBA

I have a bonehead question about using the Frequency function: how do I use
it in VBA? I have address strings for both the data and bin ranges and used
the following code:

Cells(2, jDiff + 5) = Application.WorksheetFunction.Frequency(DataStr, BinStr)

with Binstr = $AI$2:$AI$26 and DataStr = $AE$2:$AE$217; jDiff = 31 (AE)

When I run it I get the error: " Unable to get Frequency property of the
WorksheetFunction class".

Could someone please provide me with one or two lines of code (hopefully) to
show how to use it correctly?

Thanks for your help!
BonsaiBill
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 762
Default using Frequency in Excel 2002 VBA

Bonsai Bill -

FREQUENCY is an array-entered worksheet function.

I use VBA's FormulaArray property to enter it.

You may be able to adapt one of these examples for your purposes:

(a) use the macro recorder to see what's generated when you array-enter the
function, i.e., Control+Shift+Enter instead of Enter

(b) download my Better Histogram add-in from the Histogram page at
www.treeplan.com and examine the code in module Module1Main to see how I
used FormulaArray

- Mike
www.MikeMiddleton.com


"Bonsai Bill" wrote in message
...
I have a bonehead question about using the Frequency function: how do I use
it in VBA? I have address strings for both the data and bin ranges and
used
the following code:

Cells(2, jDiff + 5) = Application.WorksheetFunction.Frequency(DataStr,
BinStr)

with Binstr = $AI$2:$AI$26 and DataStr = $AE$2:$AE$217; jDiff = 31 (AE)

When I run it I get the error: " Unable to get Frequency property of the
WorksheetFunction class".

Could someone please provide me with one or two lines of code (hopefully)
to
show how to use it correctly?

Thanks for your help!
BonsaiBill



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default using Frequency in Excel 2002 VBA

Thanks Mike! I looked at your macro and see the error of my ways. I am
interested in building a histogram so I may utilize much more of your code.

"Mike Middleton" wrote:

Bonsai Bill -

FREQUENCY is an array-entered worksheet function.

I use VBA's FormulaArray property to enter it.

You may be able to adapt one of these examples for your purposes:

(a) use the macro recorder to see what's generated when you array-enter the
function, i.e., Control+Shift+Enter instead of Enter

(b) download my Better Histogram add-in from the Histogram page at
www.treeplan.com and examine the code in module Module1Main to see how I
used FormulaArray

- Mike
www.MikeMiddleton.com


"Bonsai Bill" wrote in message
...
I have a bonehead question about using the Frequency function: how do I use
it in VBA? I have address strings for both the data and bin ranges and
used
the following code:

Cells(2, jDiff + 5) = Application.WorksheetFunction.Frequency(DataStr,
BinStr)

with Binstr = $AI$2:$AI$26 and DataStr = $AE$2:$AE$217; jDiff = 31 (AE)

When I run it I get the error: " Unable to get Frequency property of the
WorksheetFunction class".

Could someone please provide me with one or two lines of code (hopefully)
to
show how to use it correctly?

Thanks for your help!
BonsaiBill




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
Excel 2002: How is the Excel 2007 file format open in Excel 2002 ? Mr. Low Excel Discussion (Misc queries) 2 August 29th 07 11:46 PM
Outlook 2002 calendar dates exported to Excel 2002 sort incorrectl scampbell Excel Worksheet Functions 0 February 22nd 06 06:31 PM
Access 2002 VB Module controlling Excel 2002 spreadsheet -Run-time Mblackmore Excel Programming 0 May 12th 05 07:56 PM
Can you print labels using Excel 2002 in a Word 2002 mail merge? Individual_ Excel Discussion (Misc queries) 3 December 17th 04 08:39 PM
Excel 2002 files attached to Outlook 2002 EMails change size AJStadlin Excel Programming 1 October 15th 03 12:12 AM


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