+ Reply to Thread
Results 1 to 5 of 5

Thread: Output results not being captured

  1. #1
    Registered User
    Join Date
    08-24-2009
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    18

    Output results not being captured

    Hello,

    I have built a model where I have various inputs and various outputs. I have managed to set up the model so that whenever i hit the 'add to portfolio' button, a new row is added putting in the details from the inputs to a new row (beginning in row 25). The problem I am having is that I cannot seem to get the output results (cells I12:I17) to be included as well. I have attached my excel file. If anyone could take a look at this, I would greatly appreciate it.

    Thanks so much,

    Ayesha
    Attached Files Attached Files
    Last edited by ayesha; 10-09-2009 at 03:46 PM.

  2. #2
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717

    Re: Output results not being captured

    Your are missing this code

    For k = 1 To Range("range_results_details").Rows.Count - 1
            Range("anchor_position_table").Offset(1, 7 + k).Value = Range("range_results_details").Cells(k, 1).Value
        Next k

  3. #3
    Registered User
    Join Date
    08-24-2009
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Output results not being captured

    Thanks Shijesh,

    Is this the correct code?

    Sub Add_Position()
        Dim i As Integer            ' loop variable
        Dim k As Integer
    
        ' insert a new row into the table
        Range("anchor_position_table").Offset(1, 0).EntireRow.Select
        Selection.Copy
        Selection.Insert Shift:=xlDown
        Application.CutCopyMode = False
        Range("anchor_position_table").Select
        
        ' copy option details into the new row
        For i = 1 To Range("range_option_details").Rows.Count
            Range("anchor_position_table").Offset(1, i - 1).Value = Range("range_option_details").Cells(i, 1).Value
        Next i
        
        For k = 1 To Range("range_results_details").Rows.Count - 1
            Range("anchor_position_table").Offset(1, 7 + k).Value = Range("range_results_details").Cells(k, 1).Value
        Next k
    End Sub
    It works except that it leaves cells N25 empty (which is the output result from I17). Could you please advise?

    Thanks,

    Ayesha

  4. #4
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717

    Re: Output results not being captured

    Sub Add_Position()
        Dim i As Integer            ' loop variable
        Dim k As Integer
    
        ' insert a new row into the table
        Range("anchor_position_table").Offset(1, 0).EntireRow.Select
        Selection.Copy
        Selection.Insert Shift:=xlDown
        Application.CutCopyMode = False
        Range("anchor_position_table").Select
        
        ' copy option details into the new row
        For i = 1 To Range("range_option_details").Rows.Count
            Range("anchor_position_table").Offset(1, i - 1).Value = Range("range_option_details").Cells(i, 1).Value
        Next i
        
        For k = 1 To Range("range_results_details").Rows.Count
            Range("anchor_position_table").Offset(1, 7 + k).Value = Range("range_results_details").Cells(k, 1).Value
        Next k
    End Sub

  5. #5
    Registered User
    Join Date
    08-24-2009
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Output results not being captured

    Thanks so much, this works great.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0