Results 1 to 5 of 5

Trouble with RSq function in VBA

Threaded View

  1. #1
    Registered User
    Join Date
    04-16-2008
    Posts
    3

    Trouble with RSq function in VBA

    First let me describe what I'm TRYING to do. I have a large dataset of test results that is Autofiltered to sort by 20 or so different columns. I also have a number of charts that conveniently show only the test results that are visible in the Autofilter. I guess this is the default behavior of charts?

    I am trying to put together a summary of performance predictors that are compared to each other by their linear regression R-squared value. The RSq function does this just fine, but it does not ignore the hidden rows when Autofiltered. So I'm writing some code to do this using the "SpecialCells(xlCellTypeVisible)" method and running into problems.

    When I create ranges like this:

    Set zcross = Sheets("Data").Range("aj3:aj1003").SpecialCells(xlCellTypeVisible)
    It works fine with the excel function Sum, and sums only the visible filtered cells. When I use this same format on 2 ranges with RSq, I get a 1004 error. When I use the range above without the SpecialCells property, RSq works just fine. Why doesn't RSq like using the SpecialCells property? I need help finding a work-around.

    One thought I had that probably isn't possible - can VBA read the R-squared value off of a chart with a best fit curve on it? Since my charts only show the filtered data this would give me what I want.
    Last edited by puckalicious; 04-17-2008 at 03:08 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1