+ Reply to Thread
Results 1 to 4 of 4

Having trouble with my loop for Goal Seek

Hybrid View

  1. #1
    Registered User
    Join Date
    08-11-2015
    Location
    UAE
    MS-Off Ver
    2010
    Posts
    8

    Having trouble with my loop for Goal Seek

    I'm trying to create a loop to conduct a goal seek to help determine debt payments. Essentially I'm trying to determine the amount of principal payment given the available cash to maintain a minimum level of Debt Service coverage ratio as well the tenor of the loan.

    i have written the following code to help me with that but i'm getting stuck even before going into the loop. The error is "Select method of Range class failed"
    I have copied this from another file and the macro seems to work just fine in that file.

    Helpful thoughts would be greatly appreciated.

    Thanks

    Sub Macro_DD()
    '
    ' Macro_DD Macro
    ' Macro for: debt repayment schedule to match the 17 year debt tenor at all times.
    '
    
    '
    Application.ScreenUpdating = False
    Sheets("Debt Schedule").Range("PDebt").ClearContents
    Sheets("Assumptions").Range("DSCR").Select
    ActiveCell.FormulaR1C1 = "1.3"
    Do While Check_Debt <> "OK"
    Sheets("Assumptions").Range("OPeriods").GoalSeek Goal:=Range("IPeriods"), ChangingCell:=Sheets("Assumptions").Range("DSCR")
        Sheets("Debt Schedule").Range("CDebt").Copy
        Sheets("Debt Schedule").Range("PDebt").PasteSpecial xlPasteValues
        Sheets("Debt Schedule").Range("CDebt").Copy
        Sheets("Debt Schedule").Range("PDebt").PasteSpecial xlPasteValues
        Sheets("Debt Schedule").Range("CDebt").Copy
        Sheets("Debt Schedule").Range("PDebt").PasteSpecial xlPasteValues
        
    Sheets("Debt Schedule").Range("CTotalDebt").GoalSeek Goal:=Range("PTotalDebt"), ChangingCell:=Sheets("Assumptions").Range("DSCR")
            Sheets("Debt Schedule").Range("CDebt").Copy
        Sheets("Debt Schedule").Range("PDebt").PasteSpecial xlPasteValues
        Sheets("Debt Schedule").Range("CDebt").Copy
        Sheets("Debt Schedule").Range("PDebt").PasteSpecial xlPasteValues
        Sheets("Debt Schedule").Range("CDebt").Copy
        Sheets("Debt Schedule").Range("PDebt").PasteSpecial xlPasteValues
        
        
    Check_Debt = Range("Check_Debt")
    Loop
    Application.CutCopyMode = False
    Sheets("Assumptions").Select
    Application.ScreenUpdating = True
    End Sub

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Having trouble with my loop for Goal Seek

    I dont see any declaration for the ranges, think thats a problem


    Kind regard

  3. #3
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: Having trouble with my loop for Goal Seek

    I dont see any declaration for the ranges, think thats a problem


    Kind regards
    Leo

  4. #4
    Registered User
    Join Date
    08-11-2015
    Location
    UAE
    MS-Off Ver
    2010
    Posts
    8

    Re: Having trouble with my loop for Goal Seek

    Thanks Leo. What do you mean when you declaration for ranges. I'm very new VB and don't know the terminology

    thanks

+ 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] Help to Create a Goal seek Loop for Ranges of cells
    By Invicta084 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2014, 02:11 PM
  2. [SOLVED] Goal Seek loop - VBA
    By colin.dickson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2013, 03:05 PM
  3. Help! Macro for a Goal Seek Loop
    By 18757173 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-07-2012, 11:26 PM
  4. Replies: 3
    Last Post: 07-27-2012, 01:44 PM
  5. Goal Seek VBA with relative 'Goal' parameter
    By alirulez in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2012, 07:19 PM
  6. Goal Seek Formula But Not Using Goal Seek
    By cady923 in forum Excel General
    Replies: 1
    Last Post: 08-05-2011, 03:53 PM
  7. Goal Seek VBA FOR/LOOP
    By BFlick11 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-04-2010, 02:50 PM
  8. [SOLVED] Goal Seek in a loop
    By Brother in forum Excel General
    Replies: 2
    Last Post: 07-22-2005, 12:05 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