+ Reply to Thread
Results 1 to 3 of 3

Inputbox/Regression Problem

  1. #1
    Matt
    Guest

    Inputbox/Regression Problem

    Hi,

    I'm a VBA novice and have found this group helpful in my learning, but
    I'm stuck with a particular piece of coding. What I'm trying to do is
    allow the user to select a Y and X range using an inputbox, which will
    then be used for a regression. Here's the problematic part of the
    macro:

    Dim piRange As Range
    On Error Resume Next
    Set piRange = Application.InputBox(prompt:="Select pi range",
    Title:="SELECT STANDARDISED RESIDUALS", Type:=8)
    If Not piRange Is Nothing Then
    MsgBox "You selected: " & piRange.Address
    Else
    MsgBox "pi range is undefined because you cancelled."
    End If

    Dim xRange As Range
    On Error Resume Next
    Set xRange = Application.InputBox(prompt:="Select x range with
    mouse", Title:="SELECT INDEPENDENT VARIABLES", Type:=8)
    If Not xRange Is Nothing Then
    MsgBox "You selected: " & xRange.Address
    Else
    MsgBox "x range is undefined because you cancelled."
    End If

    Application.Run "ATPVBAEN.XLA!Regress", _
    ActiveSheet.Range(piRange), ActiveSheet.Range(xRange), False,
    False, , _
    ActiveSheet.Range("$AF$1"), False, False, False, False, , False


    Thanks in advance,

    Matt


  2. #2
    Toppers
    Guest

    RE: Inputbox/Regression Problem

    Matt,

    Try:

    ActiveSheet.Range(piRange.Address), ActiveSheet.Range(xRange.Address),
    False, False, , _

    "Matt" wrote:

    > Hi,
    >
    > I'm a VBA novice and have found this group helpful in my learning, but
    > I'm stuck with a particular piece of coding. What I'm trying to do is
    > allow the user to select a Y and X range using an inputbox, which will
    > then be used for a regression. Here's the problematic part of the
    > macro:
    >
    > Dim piRange As Range
    > On Error Resume Next
    > Set piRange = Application.InputBox(prompt:="Select pi range",
    > Title:="SELECT STANDARDISED RESIDUALS", Type:=8)
    > If Not piRange Is Nothing Then
    > MsgBox "You selected: " & piRange.Address
    > Else
    > MsgBox "pi range is undefined because you cancelled."
    > End If
    >
    > Dim xRange As Range
    > On Error Resume Next
    > Set xRange = Application.InputBox(prompt:="Select x range with
    > mouse", Title:="SELECT INDEPENDENT VARIABLES", Type:=8)
    > If Not xRange Is Nothing Then
    > MsgBox "You selected: " & xRange.Address
    > Else
    > MsgBox "x range is undefined because you cancelled."
    > End If
    >
    > Application.Run "ATPVBAEN.XLA!Regress", _
    > ActiveSheet.Range(piRange), ActiveSheet.Range(xRange), False,
    > False, , _
    > ActiveSheet.Range("$AF$1"), False, False, False, False, , False
    >
    >
    > Thanks in advance,
    >
    > Matt
    >
    >


  3. #3
    Matt
    Guest

    Re: Inputbox/Regression Problem

    Toppers,

    That works perfectly! Thanks for your help.

    Matt


+ Reply to Thread

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