Results 1 to 8 of 8

Thread: VBA Looping Input Range and Output Range

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Junior Member
    Join Date
    Mar 2013
    Posts
    6
    Rep Power
    0
    Just a quick note to close the loop. I worked out the following solution, and would appreciate any suggestions to make it more efficient. Thanks for everyone's consideration.

    Code:
    Dim rgLife As Range
    Dim rgDeprec As Range
    
    Dim i As Long, j As Long
    Set rgDeprec = Range(Cells(lRow, 14), Cells(lRow, lColumn))
    
    Set rgLife = Range(Cells(2, 14), Cells(2, lColumn))
    For i = 1 To rgLife.Rows.Count
        For j = 1 To rgLife.Columns.Count
            If Year(EDate) > Year(rgLife.Cells(i, j).Value) Then
                Cells(lRow, 11).Copy rgDeprec.Cells(i, j)
            ElseIf Year(EDate) = Year(rgLife.Cells(i, j).Value) Then
                rgDeprec.Cells(i, j) = Cells(lRow, 10) - _
                WorksheetFunction.Sum(Range(Cells(lRow, 12), Cells(lRow, lColumn)))
            End If
        Next j
    Next i
    Last edited by Admin; 04-26-2013 at 09:36 AM.

Similar Threads

  1. Copy Table Range Till Last Row Using VBA
    By ivandgreat in forum Excel Help
    Replies: 2
    Last Post: 05-09-2013, 05:41 PM
  2. Range Difference VBA
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 2
    Last Post: 03-21-2012, 05:58 PM
  3. Split Range into Multiple Columns VBA
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 3
    Last Post: 03-07-2012, 10:53 PM
  4. Mail Range or Selection using VBA
    By LalitPandey87 in forum Excel Help
    Replies: 1
    Last Post: 11-03-2011, 09:00 AM
  5. Replies: 2
    Last Post: 10-05-2011, 04:18 PM

Posting Permissions

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