+ Reply to Thread
Results 1 to 2 of 2

Macro that works in Excel 2010 does not work in Excel 2013

  1. #1
    Registered User
    Join Date
    02-12-2016
    Location
    Cohutta, GA
    MS-Off Ver
    2013
    Posts
    2

    Macro that works in Excel 2010 does not work in Excel 2013

    I have the following code that runs a regression. I have used it for years in versions previous to Excel 2013. The code runs in Excel 2013 but the regression provides no results. I appreciate any help.




    Sub Print_Regression()
    Dim i As Integer
    Dim shtName As String
    Dim shtNo As Integer

    Application.Goto Reference:="R.Y_Var"
    shtName = ActiveSheet.Name

    For i = Range("Beginrow").Value To Range("Lastrow").Value
    'Clear regression output contents
    Application.Goto Reference:="output2"
    Selection.ClearContents

    'Get regression parameters
    Range("Dummyctr").Value = i
    Calculate
    SendKeys "{F9}", True

    'Run new regression
    Application.ExecuteExcel4Macro String:= _
    "REGRESS(" & shtName & "!R.Y_Var," & shtName & "!R.X" & Range("Mac").Value & _
    "_Var,FALSE,FALSE,," & shtName & "!R.Output,FALSE,FALSE,FALSE,FALSE,,FALSE,)"
    Application.ScreenUpdating = False
    [A1].Select
    Calculate
    SendKeys "{F9}", True

    'Copy regression statistics
    Range("M.Copy1").Copy
    Range("M.Paste").Offset(0, (i - I_1) * 2).PasteSpecial Paste:=xlValues
    Range("M.Copy2").Copy
    Range("M.Paste").Offset(1, (i - I_1) * 2).PasteSpecial Paste:=xlValues

    'Copy columns to output areas
    shtNo = Range("Sht").Value
    If Range("V.ExhLabel").Value = "Exhibit 10" Then
    Range("V.Fit2Trend").Copy
    Range("V.S" & shtNo & "C13").PasteSpecial Paste:=xlValues

    Range("V.Fit2Act").Copy
    Range("V.S" & shtNo & "C15").PasteSpecial Paste:=xlValues
    End If

    'Print regression; exhibit
    Range("P.Regression").Select
    Selection.PrintOut

    Next i
    Application.CutCopyMode = False

    End Sub

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro that works in Excel 2010 does not work in Excel 2013

    Welcome to the board, Karen.

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro to move a row works in excel 2010 but not in Excel 2013
    By mmccra2858 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-31-2015, 05:07 PM
  2. Excel to Word macro doesn't work on Word 2013 if sheet is hidden (works fine on 2010)
    By dreddster in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-29-2015, 04:37 AM
  3. Excel 4.0 macro works in 2010 but is broken in 2013
    By gregsedwards in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-04-2014, 05:48 PM
  4. Excel 2007 works but not 2010 or 2013
    By Miliano in forum Excel General
    Replies: 1
    Last Post: 10-02-2014, 03:20 AM
  5. Replies: 4
    Last Post: 04-10-2014, 12:11 PM
  6. [SOLVED] Macro works in 2010&2013 but not Excel 2003
    By Mattiac in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-06-2014, 03:12 AM
  7. Replies: 10
    Last Post: 08-20-2013, 01:02 PM

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