+ Reply to Thread
Results 1 to 8 of 8

Macro to transfer row of data between sheets based on certain criteria.

Hybrid View

  1. #1
    Registered User
    Join Date
    08-28-2012
    Location
    United Stated
    MS-Off Ver
    Excel 2010 Mac
    Posts
    5

    Macro to transfer row of data between sheets based on certain criteria.

    I need help writing a macro to transfer a row of data from one sheet to another sheet based on certain maturity date parameters. The following is what I need done pertaining to each sheet:

    Current Maturities Sheet - I need every row of data transferred from the Future Maturities Sheet to the Current Maturities Sheet for any loan maturing 60 days out from the current date.

    Future Maturities - I need every row of data transferred from the Data Sheet to the Future Maturities Sheet for any loan maturing 12 months out.

    *I have highlighted the column which the criteria will be based upon.

    Can this be done or am I being overzealous with my thought process? I'm pretty new at even attempting VBA, so please be patient with me, thank you.

    Matured Loans Spreadsheet.xlsx

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to transfer row of data between sheets based on certain criteria.

    Exactly 60 Days? Or 60 Days plus?

  3. #3
    Registered User
    Join Date
    08-28-2012
    Location
    United Stated
    MS-Off Ver
    Excel 2010 Mac
    Posts
    5

    Re: Macro to transfer row of data between sheets based on certain criteria.

    I'd prefer exactly 60 days. Is this something that may be doable?

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to transfer row of data between sheets based on certain criteria.

    Unfortunately I have to go until Monday so I hope this does what you want. Your idea is very doable, however, at the moment I don't have time. I did put this together and I hope it works.

    Sub kmc86()
    
    Dim rcell As Range
    Dim lr As Long
    
    Sheets("Future Maturities").Activate
    
    lr = Cells(Rows.Count, 1).End(xlUp).Row
    
    For Each rcell In Range("E2:E" & lr)
    
        If rcell.Value = Date + 60 Then
        
            rcell.EntireRow.Copy Sheets("Current Maturities").Range("A" & Rows.Count).End(3)(2)
            rcell.EntireRow.Delete shift:=xlUp
            
        End If
        
    Next rcell
        
    
    Sheets("Data").Activate
    
    lr = Cells(Rows.Count, 1).End(xlUp).Row
    
    For Each rcell In Range("E2:E" & lr)
    
        If rcell.Value = Date + 365 Then
        
            rcell.EntireRow.Copy Sheets("Future Maturities").Range("A" & Rows.Count).End(3)(2)
            rcell.EntireRow.Delete shift:=xlUp
        End If
        
    Next rcell
    
    End Sub

  5. #5
    Registered User
    Join Date
    08-28-2012
    Location
    United Stated
    MS-Off Ver
    Excel 2010 Mac
    Posts
    5

    Re: Macro to transfer row of data between sheets based on certain criteria.

    Sorry, I didn't initially understand the context of the question. But if it's to keep in line with the 12 month time line for the other sheet, it could be 2 months out.

  6. #6
    Registered User
    Join Date
    08-28-2012
    Location
    United Stated
    MS-Off Ver
    Excel 2010 Mac
    Posts
    5

    Re: Macro to transfer row of data between sheets based on certain criteria.

    I'm out of the office as well, I will check this on Monday and let you know! Thank you John.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro to transfer row of data between sheets based on certain criteria.

    You're welcome, hope it works.

  8. #8
    Registered User
    Join Date
    08-28-2012
    Location
    United Stated
    MS-Off Ver
    Excel 2010 Mac
    Posts
    5

    Re: Macro to transfer row of data between sheets based on certain criteria.

    John,

    I input the code and tried running it, but to no avail no information transferred to the other sheets. In being discrete about information, I had to change the composition from the original excel file that I posted. The header contains the following: A:1 - Portfolio Manager; B:1 - Business Name; C:1 - Loan ID; D:1 - Maturity Date; E:1 - Principal Balance. Make note that I did change the rcell range from the original E2:E to D2:D. Is there something that I need to change?

+ 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