VBA Cut and Paste Data From One Sheet to appropriate Sheet based on FY Date

TimPin

New Member
Joined
Apr 23, 2019
Messages
20
Hello, I am hoping someone can help me with my dilemma, I don't even know where to begin coding this one.

I have a Workbook with 6 Sheets: TRACKER, FY19 SUMMARY, FY20 SUMMARY, FY21 SUMMARY, FY22 SUMMARY, FY23SUMMARY, and FY24 SUMMARY.

I need to move a portion of a row of data from the TRACKER worksheet to the appropriate FY SUMMARY worksheet based on Fiscal Year. There is a macro to place a Check Mark Symbol in columns E-I when clicked and a formula to calculate Expiration Date in Column K and Fiscal Year in Column M.

I need to append the cells in Columns A-L after the last row of data in appropriate Fiscal year worksheet when Column L is populated, I don't want any formatting or formulas to be copied, only the contents.

Each of the columns A-M have a header in Row 1 and each of the FY SUMMARY sheets have the same headers for rows A-L (Fiscal Year not copied).

I am going to place a Macro Button in the spreadsheet to perform the operation.

Any help would be greatly appreciated.

My TRACKER Sheet looks like this.

A B C D E F G H I J K L M
Last NameFirst NameRankUnitMember Sig.Unit Com. Sig.Group Com. SigMSG/Wing Com. SigSVS ApprovalApproval DateExpiration DateCheck Out DateFiscal Year
SmithJohnPvt.199XXXXX4/1/20195/16/20194/22/20192019

<tbody>
</tbody>
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try running the macro I posted in Post# 10 manually without using the button. You can do that by pressing the F5 key in the Visual Basic Editor. If it still doesn't work, perhaps you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.
 
Upvote 0
Try:
Code:
Private Sub CommandButton1_Click()
    Application.ScreenUpdating = False
    Dim desWS As Worksheet, rng As Range, LastRow As Long
    LastRow = Range("A" & Rows.Count).End(xlUp).Row
    For Each rng In Range("L2:L" & LastRow)
        If rng <> "" Then
            Set desWS = Sheets("FY" & Right(rng.Offset(0, 1), 2) & " SUMMARY")
            Range("A" & rng.Row).Resize(, 12).Copy
            desWS.Cells(desWS.Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
        End If
    Next rng
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
That works great with one exception. I need it to delete the data on the TRACKER after it has been moved.
 
Upvote 0
Try:
Code:
Private Sub CommandButton1_Click()
    Application.ScreenUpdating = False
    Application.EnableEvents = False
    Dim desWS As Worksheet, x As Long, LastRow As Long
    LastRow = Range("A" & Rows.Count).End(xlUp).Row
    For x = LastRow To 2 Step -1
        If Cells(x, 12) <> "" Then
            Set desWS = Sheets("FY" & Right(Cells(x, 13), 2) & " SUMMARY")
            Range("A" & x).Resize(, 12).Copy
            desWS.Cells(desWS.Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
            ActiveSheet.Range("A" & x).Resize(, 13).Delete
        End If
    Next x
    Application.CutCopyMode = False
    Application.EnableEvents = True
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top