Copying Data from Sheet 1 to Sheet 2 and adding rows- Code Needed

bamaisgreat

Well-known Member
Joined
Jan 23, 2012
Messages
831
Office Version
  1. 365
Platform
  1. Windows
Starting at A17 on Sheet 1 I have a row of data that I need the data from columns A,B,C,D and G (Column B is a specific ship date) copied to one of the ranges in sheet 2 that contain the 4 quaters of the year. The date in coulmn B determines which range of the quartely ranges it goes into. On sheet 2 the 4 quaters of the year 1st Quater Jan-March 2024 Range A4-Q4, 2nd Quarter April-June 2024 Range A6-Q6, 3rd Quarter July-Sep 2024 Range A8-Q8, 4th Quarter Oct-Dec 2024 Range A8-Q10. Once the data has been entered on sheet 1 I need it add another row with the same formatting as the row above it so the next line of data can be entered. On sheet 2 I also need a row added with the same formatting as the row above it to which ever quaterly ranges the data was copied into.
 
Do you not want column G copied as well?

Currently, the Sheet1 you posted has no formatting such as cell and font color. Does your actual Sheet1 have any kind of formatting? If it does, please re-post it with the color formatting included.

Just to confirm: You want the code to be triggered after you enter the date in column B. Is this correct? If so, each time you make any changes in Sheet1 that you want copied to Sheet2, you will have to re-enter the date.

Yes, copy column G as well. Sorry I missed that.

As far as the formatting to be copied from sheet 1 we just need the border and same text and size.

Yes have date trigger when entered or re-entered.

Thanks again.
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your Sheet1 and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. When adding a new row of data in Sheet1, first enter all the data except the date and then lastly enter the date in column B. After entering the date, press the RETURN key. If changing data to an existing row, again make all the changes first and the lastly enter the date followed by the RETURN key.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Target.Column <> 2 Then Exit Sub
    Application.ScreenUpdating = False
    Dim proj As Range, fnd As Range, desWS As Worksheet, Val As String
    Set desWS = Sheets("Sheet2")
    Select Case True
        Case Target >= DateSerial(Year(Target), 1, 1) And Target <= DateSerial(Year(Target), 3, 31)
            Val = "1st"
        Case Target >= DateSerial(Year(Target), 4, 1) And Target <= DateSerial(Year(Target), 6, 30)
            Val = "2nd"
        Case Target >= DateSerial(Year(Target), 7, 1) And Target <= DateSerial(Year(Target), 9, 30)
            Val = "3rd"
        Case Target >= DateSerial(Year(Target), 10, 1) And Target <= DateSerial(Year(Target), 12, 31)
            Val = "4th"
    End Select
    With desWS
        Set proj = .Range("A:A").Find(Target.Offset(, -1), LookIn:=xlValues, lookat:=xlWhole)
        If proj Is Nothing Then
            Set fnd = .Range("G:G").Find(Val, LookIn:=xlValues, lookat:=xlPart)
            .Rows(fnd.Row + 1).EntireRow.Insert
            .Rows(fnd.Row + 1).Interior.ColorIndex = xlNone
            Range("A" & Target.Row).Resize(, 4).Copy .Range("A" & fnd.Row + 1)
            Range("G" & Target.Row).Resize(, 4).Copy .Range("G" & fnd.Row + 1)
            .Range("D" & fnd.Row + 1).HorizontalAlignment = xlCenter
        Else
            Range("A" & Target.Row).Resize(, 4).Copy .Range("A" & proj.Row + 1)
            Range("G" & Target.Row).Resize(, 4).Copy .Range("G" & proj.Row + 1)
            .Range("D" & proj.Row + 1).HorizontalAlignment = xlCenter
        End If
    End With
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Mumps, when I edit one of the rows on sheet 1 and re-enter the date it is creating a new line on sheet 2 with the edited data. Could you possibly make this where it would just correct that row of data on sheet 2 instead or creating a new line??

Thanks, Jamey
 
Upvote 0
The macro uses the project number in column A to identify if that number exists in Sheet2. If it exists, it modifies the existing data in Sheet2. If it doesn’t exist, it adds the data to the bottom of Sheet2. Makes sure that the project number of the row you edit exists in Sheet2.
 
Upvote 0
On the mini sheets below on sheet 1 I went to the row that has F3713 (Row 32) as the project number and added a note in column G and when I re-entered the date and pressed the RETURN key it actually made a copy of the row (Row 36 & 37) with the note and added it under the orginal row instead of changing the orginal row. I believe it is also copying column I & J from sheet 1 and adding it to sheet 2 instead of just copying A,B,C,D & G. Im probably doing something wrong but Im not sure what it is.

One other thing. Is the code creating a new row on sheet 2 under the Quater of the Year it is being copied into so it will be able to accept the next new row of data?

Thanks,


WORKING ON Franklin Job Review .xlsm
ABCDEFGHIJKLMNO
1FMI's Current Backlong of Projects
2ProjectShip DateCustomerJob Type Status% CompNotes CONTRACT PRICEInvoiced %AMOUNT BILLED TO DATEMargin ESTIMATED GROSS PROFITCOSTS TO DATEFMI Cost GG Cost
3Ret- Jobs
4F2048-RET2Allied Lock
5F2559AL-RET2
6F2612-RET5
7F2646-RET3
8F3105-RET4
9F3208-RET4
10F3348-RET5
11F3544-RET2
12F3616A-RET1
13
14
15F- Jobs
16ProjectShip DateCustomerJob Type Status% CompNotes CONTRACT PRICEInvoiced %AMOUNT BILLED TO DATEMargin ESTIMATED GROSS PROFITCOSTS TO DATEFMI Cost GG Cost
17F3685Dec-24BigBeeF3685-PTW LineShipped / Not Closed 95%$0.00
18F3668Dec-23AceroF3668-Material Handling Line Shipped / Not Closed Load containers next week50%
19F3669Apr-24ACEROF3669-20" Flange LinesFab/ Machine50%$0.00
20F3670Feb-24ACEROF3670-PTW LineIn Machine Shop50%$0.00
21F3697Jan-24New MilleniumF3697-4330 Angle ShearIn Machine Shopbegin 35%$0.00
22F3699May-24Standard StructuresF3699- PTW 72FabReleased with F367035%$0.00
23F3700May-24Standard StructuresF3700-Plasma System Fab35%$0.00
24F3701May-24Standard StructuresF3701-Plate/Flange FabReleased with F369035%$0.00
25F3703Jan-24CNH IndustriesF3703-Angle LineIn Machine Shop60%$0.00
26F3704Apr-24Ideal SteelF3704-PTW Fab/ Machine35%$0.00
27F3705Feb-24Chief BuildingsF3705- Plate/Flange LineFab/ Machine35%$0.00
28F3707Mar-24ASTA DoorF3707-Angle Line with CoopersProgramming 35%$0.00
29F3710Nov-24Lucas MetalsF3710-PTW 72Engineering35%$0.00
30F3711Nov-24Lucas MetalsF3711-Plasma SystemEngineering35%$0.00
31F3712Nov-24Lucas MetalsF3712-Plate/Flange Line Engineering35%$0.00
32F3713Dec-24Valley JoistF3713-Valley Joist Angle LineEngineeringTest-35%$0.00
33F3714Dec-24Vulcraft - TexasF3714-Long Span Angle LineEngineering35%$0.00
34F3715Jan-25Central States F3715-Plasma LineEngineering35%$0.00
35F3716Jan-25Central States F3716-PTW 72Engineering35%$0.00
36F3717Jan-25Central States F3717-Plate/Flange Line Engineering35%$0.00
37F3718Aug-24SiemansF3718-BusBarProgramming 20%$0.00
38F3719Aug-24SiemansF3719-BusBarEngineering20%$0.00
39F3720Aug-24SiemansF3720-BusBarEngineering20%$0.00
40F3721Aug-24SiemansF3721-BusBarEngineering20%$0.00
41F3722Oct-24SiemansF3722-BusBarEngineering20%$0.00
42F3723Oct-24SiemansF3723-BusBarEngineering20%$0.00
43F3724Oct-24SiemansF3724-BusBarEngineering20%$0.00
44F3725Mar-24Bham Rail F3725 - Rail PressEngineering35%$0.00
45F3727Mar-25ACI Buildings ExpansionF3727-72x240 slat table Engineering35%$0.00
46F3728Mar-25ACI Buildings ExpansionF3728-Plate/Flange LineEngineering35%$0.00
47F3729Mar-25ACI Buildings ExpansionF3729- PTW 72Engineering35%$0.00
48F3730Jan-24SBS BuildingsF3730- Web seamersEngineering35%$0.00
49F3731Dec-24AIG ControlsF3731- Shears / Nothers / PunchesEngineering$0.00
50
51
52
53
54
55
56
Sheet1
Cell Formulas
RangeFormula
J17,J19:J49J17=H17*I17


WORKING ON Franklin Job Review .xlsm
ABCDEFGHIJKLMNOPQ
1FMI's Current Backlong of Major Projects
2ProjectShip DateCustomerJob Type Status% CompNotes EngineeringPurchasing Machine ShopFab ShopAssembly
31st Quarter Jan-Mar 2024
4F3730Jan-24SBS BuildingsF3730- Web seamers
5F3729Mar-25ACI Buildings ExpansionF3729- PTW 72
6F3728Mar-25ACI Buildings ExpansionF3728-Plate/Flange Line
7F3727Mar-25ACI Buildings ExpansionF3727-72x240 slat table
8F3725Mar-24Bham Rail F3725 - Rail Press
9F3717Jan-25Central States F3717-Plate/Flange Line
10F3716Jan-25Central States F3716-PTW 72
11F3715Jan-25Central States F3715-Plasma Line
12F3707Mar-24ASTA DoorF3707-Angle Line with Coopers
13F3705Feb-24Chief BuildingsF3705- Plate/Flange Line
14F3703Jan-24CNH IndustriesF3703-Angle Line
15F3703Jan-24CNH IndustriesF3703-Angle Line
16F3670Feb-24ACEROF3670-PTW Line
17
182nd Quarter April-June 2024
19F3704Apr-24Ideal SteelF3704-PTW
20F3701May-24Standard StructuresF3701-Plate/Flange Released with F3690
21F3700May-24Standard StructuresF3700-Plasma System
22F3699May-24Standard StructuresF3699- PTW 72Released with F3670
23F3669Apr-24ACEROF3669-20" Flange Lines
24
253rd Quarter July-Sep 2024
26F3720Aug-24SiemansF3720-BusBar
27F3719Aug-24SiemansF3719-BusBar
28F3718Aug-24SiemansF3718-BusBar
29
304th Quarter Oct-Dec 2024
31F3731Dec-24AIG ControlsF3731- Shears / Nothers / Punches
32F3724Oct-24SiemansF3724-BusBar
33F3723Oct-24SiemansF3723-BusBar
34F3722Oct-24SiemansF3722-BusBar
35F3714Dec-24Vulcraft - TexasF3714-Long Span Angle Line
36F3713Dec-24Valley JoistF3713-Valley Joist Angle Line
37F3713Dec-24Valley JoistF3713-Valley Joist Angle LineTest-35%$0.00
38F3711Nov-24Lucas MetalsF3711-Plasma System
39F3710Nov-24Lucas MetalsF3710-PTW 72
40F3668Dec-23AceroF3668-Material Handling Line Load containers next week
41F3685Dec-24BigBeeF3685-PTW LineComplete
42
Sheet2
Cell Formulas
RangeFormula
J37J37=H37*I37
Cells with Conditional Formatting
CellConditionCell FormatStop If True
O4:O17Other TypeColor scaleNO
O4:O17Other TypeColor scaleNO
O4:O17Other TypeColor scaleNO
O4:O17Other TypeColor scaleNO
O4:O17Other TypeColor scaleNO
O4:O17Other TypeColor scaleNO
Q4:Q17Other TypeColor scaleNO
Q4:Q17Other TypeColor scaleNO
Q4:Q17Other TypeColor scaleNO
Q4:Q17Other TypeColor scaleNO
Q4:Q17Other TypeColor scaleNO
Q4:Q17Other TypeColor scaleNO
M4:M17Other TypeColor scaleNO
M4:M17Other TypeColor scaleNO
M4:M17Other TypeColor scaleNO
M4:M17Other TypeColor scaleNO
M4:M17Other TypeColor scaleNO
M4:M17Other TypeColor scaleNO
K4:K17Other TypeColor scaleNO
K4:K17Other TypeColor scaleNO
K4:K17Other TypeColor scaleNO
K4:K17Other TypeColor scaleNO
K4:K17Other TypeColor scaleNO
K4:K17Other TypeColor scaleNO
I4:I17Other TypeColor scaleNO
I4:I17Other TypeColor scaleNO
I4:I17Other TypeColor scaleNO
I4:I17Other TypeColor scaleNO
I4:I17Other TypeColor scaleNO
I4:I17Other TypeColor scaleNO
I4:I17Other TypeColor scaleNO
I4:I17Other TypeColor scaleNO
I4:I17Other TypeColor scaleNO
I4:I17Cell Value=1textNO
K4:K17Other TypeColor scaleNO
K4:K17Other TypeColor scaleNO
K4:K17Other TypeColor scaleNO
K4:K17Cell Value=1textNO
M4:M17Other TypeColor scaleNO
M4:M17Other TypeColor scaleNO
M4:M17Other TypeColor scaleNO
M4:M17Cell Value=1textNO
O4:O17Other TypeColor scaleNO
O4:O17Other TypeColor scaleNO
O4:O17Other TypeColor scaleNO
O4:O17Cell Value=1textNO
Q4:Q17Other TypeColor scaleNO
Q4:Q17Other TypeColor scaleNO
Q4:Q17Other TypeColor scaleNO
Q4:Q17Cell Value=1textNO
O19:O23Other TypeColor scaleNO
O19:O23Other TypeColor scaleNO
O19:O23Other TypeColor scaleNO
O19:O23Other TypeColor scaleNO
O19:O23Other TypeColor scaleNO
O19:O23Other TypeColor scaleNO
Q19:Q23Other TypeColor scaleNO
Q19:Q23Other TypeColor scaleNO
Q19:Q23Other TypeColor scaleNO
Q19:Q23Other TypeColor scaleNO
Q19:Q23Other TypeColor scaleNO
Q19:Q23Other TypeColor scaleNO
M19:M23Other TypeColor scaleNO
M19:M23Other TypeColor scaleNO
M19:M23Other TypeColor scaleNO
M19:M23Other TypeColor scaleNO
M19:M23Other TypeColor scaleNO
M19:M23Other TypeColor scaleNO
K19:K23Other TypeColor scaleNO
K19:K23Other TypeColor scaleNO
K19:K23Other TypeColor scaleNO
K19:K23Other TypeColor scaleNO
K19:K23Other TypeColor scaleNO
K19:K23Other TypeColor scaleNO
I19:I23Other TypeColor scaleNO
I19:I23Other TypeColor scaleNO
I19:I23Other TypeColor scaleNO
I19:I23Other TypeColor scaleNO
I19:I23Other TypeColor scaleNO
I19:I23Other TypeColor scaleNO
I19:I23Other TypeColor scaleNO
I19:I23Other TypeColor scaleNO
I19:I23Other TypeColor scaleNO
I19:I23Cell Value=1textNO
K19:K23Other TypeColor scaleNO
K19:K23Other TypeColor scaleNO
K19:K23Other TypeColor scaleNO
K19:K23Cell Value=1textNO
M19:M23Other TypeColor scaleNO
M19:M23Other TypeColor scaleNO
M19:M23Other TypeColor scaleNO
M19:M23Cell Value=1textNO
O19:O23Other TypeColor scaleNO
O19:O23Other TypeColor scaleNO
O19:O23Other TypeColor scaleNO
O19:O23Cell Value=1textNO
Q19:Q23Other TypeColor scaleNO
Q19:Q23Other TypeColor scaleNO
Q19:Q23Other TypeColor scaleNO
Q19:Q23Cell Value=1textNO
O31:O42Other TypeColor scaleNO
O31:O42Other TypeColor scaleNO
O31:O42Other TypeColor scaleNO
O31:O42Other TypeColor scaleNO
O31:O42Other TypeColor scaleNO
O31:O42Other TypeColor scaleNO
Q31:Q42Other TypeColor scaleNO
Q31:Q42Other TypeColor scaleNO
Q31:Q42Other TypeColor scaleNO
Q31:Q42Other TypeColor scaleNO
Q31:Q42Other TypeColor scaleNO
Q31:Q42Other TypeColor scaleNO
M31:M42Other TypeColor scaleNO
M31:M42Other TypeColor scaleNO
M31:M42Other TypeColor scaleNO
M31:M42Other TypeColor scaleNO
M31:M42Other TypeColor scaleNO
M31:M42Other TypeColor scaleNO
K31:K42Other TypeColor scaleNO
K31:K42Other TypeColor scaleNO
K31:K42Other TypeColor scaleNO
K31:K42Other TypeColor scaleNO
K31:K42Other TypeColor scaleNO
K31:K42Other TypeColor scaleNO
I31:I42Other TypeColor scaleNO
I31:I42Other TypeColor scaleNO
I31:I42Other TypeColor scaleNO
I31:I42Other TypeColor scaleNO
I31:I42Other TypeColor scaleNO
I31:I42Other TypeColor scaleNO
I31:I42Other TypeColor scaleNO
I31:I42Other TypeColor scaleNO
I31:I42Other TypeColor scaleNO
I31:I42Cell Value=1textNO
K31:K42Other TypeColor scaleNO
K31:K42Other TypeColor scaleNO
K31:K42Other TypeColor scaleNO
K31:K42Cell Value=1textNO
M31:M42Other TypeColor scaleNO
M31:M42Other TypeColor scaleNO
M31:M42Other TypeColor scaleNO
M31:M42Cell Value=1textNO
O31:O42Other TypeColor scaleNO
O31:O42Other TypeColor scaleNO
O31:O42Other TypeColor scaleNO
O31:O42Cell Value=1textNO
Q31:Q42Other TypeColor scaleNO
Q31:Q42Other TypeColor scaleNO
Q31:Q42Other TypeColor scaleNO
Q31:Q42Cell Value=1textNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Cell Value=1textNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Cell Value=1textNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Cell Value=1textNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Cell Value=1textNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Cell Value=1textNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Cell Value=1textNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Cell Value=1textNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Cell Value=1textNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Cell Value=1textNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Cell Value=1textNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Cell Value=1textNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Cell Value=1textNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Cell Value=1textNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Cell Value=1textNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Cell Value=1textNO
 
Upvote 0
Try:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Target.Column <> 2 Then Exit Sub
    Application.ScreenUpdating = False
    Dim proj As Range, fnd As Range, desWS As Worksheet, Val As String
    Set desWS = Sheets("Sheet2")
    Select Case True
        Case Target >= DateSerial(Year(Target), 1, 1) And Target <= DateSerial(Year(Target), 3, 31)
            Val = "1st"
        Case Target >= DateSerial(Year(Target), 4, 1) And Target <= DateSerial(Year(Target), 6, 30)
            Val = "2nd"
        Case Target >= DateSerial(Year(Target), 7, 1) And Target <= DateSerial(Year(Target), 9, 30)
            Val = "3rd"
        Case Target >= DateSerial(Year(Target), 10, 1) And Target <= DateSerial(Year(Target), 12, 31)
            Val = "4th"
    End Select
    With desWS
        Set proj = .Range("A:A").Find(Target.Offset(, -1), LookIn:=xlValues, lookat:=xlWhole)
        If proj Is Nothing Then
            Set fnd = .Range("G:G").Find(Val, LookIn:=xlValues, lookat:=xlPart)
            .Rows(fnd.Row + 1).EntireRow.Insert
            .Rows(fnd.Row + 1).Interior.ColorIndex = xlNone
            Range("A" & Target.Row).Resize(, 4).Copy .Range("A" & fnd.Row + 1)
            Range("G" & Target.Row).Resize(, 4).Copy .Range("G" & fnd.Row + 1)
            .Range("D" & fnd.Row + 1).HorizontalAlignment = xlCenter
        Else
            Range("A" & Target.Row).Resize(, 4).Copy .Range("A" & proj.Row)
            Range("G" & Target.Row).Copy .Range("G" & proj.Row)
            .Range("D" & proj.Row).HorizontalAlignment = xlCenter
        End If
    End With
    Application.ScreenUpdating = True
End Sub
One other thing. Is the code creating a new row on sheet 2 under the Quater of the Year it is being copied into so it will be able to accept the next new row of data?
Yes.
 
Upvote 0
Thanks that works good. Ive been trying to research on how to tweak the code to fix a couple things its doing but havnt had much luck. If you have the opportunity could you see what might could be done with the items below.

* When I create a new row on sheet 1 and enter date it is copying the data in columns I and J and putting them on sheet 2 instead of just columns A,B,C,D & G

* I added a 5th Quater to sheet 2 and wanted to see if all the rows of project that have the year 2025 could be copied there.

* And the last one is could the rows under the 1st, 2nd, 3rd, 4th & 5th quater somehow be in numerical order under each or the quaters. (Not sure I explained this one very good.
 
Upvote 0
Please post updated sheets showing the fifth quarter.
 
Upvote 0
Yes. See below. When you orginally started writing the code for this I didnt see that some of the ship dates had 2025 in them.

WORKING ON Franklin Job Review .xlsm
ABCDEFGHIJKLMNO
1FMI's Current Backlong of Projects
2ProjectShip DateCustomerJob Type Status% CompNotes CONTRACT PRICEInvoiced %AMOUNT BILLED TO DATEMargin ESTIMATED GROSS PROFITCOSTS TO DATEFMI Cost GG Cost
3Ret- Jobs
4F2048-RET2Allied Lock
5F2559AL-RET2
6F2612-RET5
7F2646-RET3
8F3105-RET4
9F3208-RET4
10F3348-RET5
11F3544-RET2
12F3616A-RET1
13
14
15F- Jobs
16ProjectShip DateCustomerJob Type Status% CompNotes CONTRACT PRICEInvoiced %AMOUNT BILLED TO DATEMargin ESTIMATED GROSS PROFITCOSTS TO DATEFMI Cost GG Cost
17F3685Dec-24BigBeeF3685-PTW LineShipped / Not Closed sdfsda1000%$100.00
18F3668Dec-24AceroF3668-Material Handling Line Shipped / Not Closed Load containers next week50%
19F3669Apr-24ACEROF3669-20" Flange LinesFab/ Machine50%$0.00
20F3670Feb-24ACEROF3670-PTW LineIn Machine Shop50%$0.00
21F3697Jan-24New MilleniumF3697-4330 Angle ShearIn Machine Shopbegin 35%$0.00
22F3699May-24Standard StructuresF3699- PTW 72FabReleased with F367035%$0.00
23F3700May-24Standard StructuresF3700-Plasma System Fab35%$0.00
24F3701May-24Standard StructuresF3701-Plate/Flange FabReleased with F369035%$0.00
25F3703Jan-24CNH IndustriesF3703-Angle LineIn Machine Shop60%$0.00
26F3704Apr-24Ideal SteelF3704-PTW Fab/ Machine35%$0.00
27F3705Feb-24Chief BuildingsF3705- Plate/Flange LineFab/ Machine35%$0.00
28F3707Mar-24ASTA DoorF3707-Angle Line with CoopersProgramming 35%$0.00
29F3710Nov-24Lucas MetalsF3710-PTW 72Engineering35%$0.00
30F3711Nov-24Lucas MetalsF3711-Plasma SystemEngineering35%$0.00
31F3712Nov-24Lucas MetalsF3712-Plate/Flange Line Engineering35%$0.00
32F3713Dec-24Valley JoistF3713-Valley Joist Angle LineEngineering35%$0.00
33F3714Dec-24Vulcraft - TexasF3714-Long Span Angle LineEngineering35%$0.00
34F3715Jan-25Central States F3715-Plasma LineEngineering35%$0.00
35F3716Jan-25Central States F3716-PTW 72Engineering35%$0.00
36F3717Jan-24Central States F3717-Plate/Flange Line Engineering35%$0.00
37F3718Aug-24SiemansF3718-BusBarProgramming 20%$0.00
38F3719Aug-24SiemansF3719-BusBarEngineering20%$0.00
39F3720Aug-24SiemansF3720-BusBarEngineering20%$0.00
40F3721Aug-24SiemansF3721-BusBarEngineering20%$0.00
41F3722Oct-24SiemansF3722-BusBarEngineering20%$0.00
42F3723Oct-24SiemansF3723-BusBarEngineering20%$0.00
43F3724Oct-24SiemansF3724-BusBarEngineering20%$0.00
44F3725Mar-24Bham Rail F3725 - Rail PressEngineering35%$0.00
45F3727Mar-25ACI Buildings ExpansionF3727-72x240 slat table Engineering35%$0.00
46F3728Mar-25ACI Buildings ExpansionF3728-Plate/Flange LineEngineering35%$0.00
47F3729Mar-25ACI Buildings ExpansionF3729- PTW 72Engineering35%$0.00
48F3730Jan-24SBS BuildingsF3730- Web seamersEngineering35%$0.00
49F3731Dec-24AIG ControlsF3731- Shears / Nothers / PunchesEngineering$0.00
50
51
52
53
Sheet1
Cell Formulas
RangeFormula
J19:J49J19=H19*I19


WORKING ON Franklin Job Review .xlsm
ABCDEFGHIJKLMNOPQ
1SHEET IS ►UNPROTECTEDFMI's Current Backlong of Major Projects
2ProjectShip DateCustomerJob Type Status% CompNotes EngineeringPurchasing Machine ShopFab ShopAssembly
31st Quarter Jan-Mar 2024
4F3729Mar-25ACI Buildings ExpansionF3729- PTW 72
5F3728Mar-25ACI Buildings ExpansionF3728-Plate/Flange Line
6F3727Mar-25ACI Buildings ExpansionF3727-72x240 slat table
7F3725Mar-24Bham Rail F3725 - Rail Press
8F3717Jan-24Central States F3717-Plate/Flange Line
9F3716Jan-25Central States F3716-PTW 72
10F3715Jan-25Central States F3715-Plasma Line
11F3707Mar-24ASTA DoorF3707-Angle Line with Coopers
12F3705Feb-24Chief BuildingsF3705- Plate/Flange Line
13F3703Jan-24CNH IndustriesF3703-Angle Line
14F3703Jan-24CNH IndustriesF3703-Angle Line
15F3670Feb-24ACEROF3670-PTW Line
16
172nd Quarter April-June 2024
18F3751May-24GGNew Hello
19F3704Apr-24Ideal SteelF3704-PTW
20F3701May-24Standard StructuresF3701-Plate/Flange Released with F3690
21F3700May-24Standard StructuresF3700-Plasma System
22F3699May-24Standard StructuresF3699- PTW 72Released with F3670
23F3669Apr-24ACEROF3669-20" Flange Lines
24
253rd Quarter July-Sep 2024
26F3720Aug-24SiemansF3720-BusBar
27F3719Aug-24SiemansF3719-BusBar
28F3718Aug-24SiemansF3718-BusBar
29
304th Quarter Oct-Dec 2024
31F3731Dec-24AIG ControlsF3731- Shears / Nothers / Punches
32F3724Oct-24SiemansF3724-BusBar
33F3723Oct-24SiemansF3723-BusBar
34F3722Oct-24SiemansF3722-BusBar
35F3714Dec-24Vulcraft - TexasF3714-Long Span Angle Line
36F3713Dec-24Valley JoistF3713-Valley Joist Angle Line
37F3711Nov-24Lucas MetalsF3711-Plasma System
38F3710Nov-24Lucas MetalsF3710-PTW 72
39F3668Dec-24AceroF3668-Material Handling Line Load containers next week
40F3685Dec-24BigBeeF3685-PTW Line
41
425th Quarter 2025
43
44
45
Sheet2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
E1Expression=$E1="UNPROTECTED"textNO
E1Expression=$E1="PROTECTED"textNO
I43:I45Other TypeColor scaleNO
I43:I45Other TypeColor scaleNO
I43:I45Other TypeColor scaleNO
I43:I45Other TypeColor scaleNO
I43:I45Other TypeColor scaleNO
I43:I45Other TypeColor scaleNO
I43:I45Other TypeColor scaleNO
I43:I45Other TypeColor scaleNO
I43:I45Other TypeColor scaleNO
I43:I45Cell Value=1textNO
K43:K45Other TypeColor scaleNO
K43:K45Other TypeColor scaleNO
K43:K45Other TypeColor scaleNO
K43:K45Other TypeColor scaleNO
K43:K45Other TypeColor scaleNO
K43:K45Other TypeColor scaleNO
K43:K45Other TypeColor scaleNO
K43:K45Other TypeColor scaleNO
K43:K45Other TypeColor scaleNO
K43:K45Cell Value=1textNO
M43:M45Other TypeColor scaleNO
M43:M45Other TypeColor scaleNO
M43:M45Other TypeColor scaleNO
M43:M45Other TypeColor scaleNO
M43:M45Other TypeColor scaleNO
M43:M45Other TypeColor scaleNO
M43:M45Other TypeColor scaleNO
M43:M45Other TypeColor scaleNO
M43:M45Other TypeColor scaleNO
M43:M45Cell Value=1textNO
O43:O45Other TypeColor scaleNO
O43:O45Other TypeColor scaleNO
O43:O45Other TypeColor scaleNO
O43:O45Other TypeColor scaleNO
O43:O45Other TypeColor scaleNO
O43:O45Other TypeColor scaleNO
O43:O45Other TypeColor scaleNO
O43:O45Other TypeColor scaleNO
O43:O45Other TypeColor scaleNO
O43:O45Cell Value=1textNO
Q43:Q45Other TypeColor scaleNO
Q43:Q45Other TypeColor scaleNO
Q43:Q45Other TypeColor scaleNO
Q43:Q45Other TypeColor scaleNO
Q43:Q45Other TypeColor scaleNO
Q43:Q45Other TypeColor scaleNO
Q43:Q45Other TypeColor scaleNO
Q43:Q45Other TypeColor scaleNO
Q43:Q45Other TypeColor scaleNO
Q43:Q45Cell Value=1textNO
O18:O23Other TypeColor scaleNO
O18:O23Other TypeColor scaleNO
O18:O23Other TypeColor scaleNO
O18:O23Other TypeColor scaleNO
O18:O23Other TypeColor scaleNO
O18:O23Other TypeColor scaleNO
Q18:Q23Other TypeColor scaleNO
Q18:Q23Other TypeColor scaleNO
Q18:Q23Other TypeColor scaleNO
Q18:Q23Other TypeColor scaleNO
Q18:Q23Other TypeColor scaleNO
Q18:Q23Other TypeColor scaleNO
M18:M23Other TypeColor scaleNO
M18:M23Other TypeColor scaleNO
M18:M23Other TypeColor scaleNO
M18:M23Other TypeColor scaleNO
M18:M23Other TypeColor scaleNO
M18:M23Other TypeColor scaleNO
K18:K23Other TypeColor scaleNO
K18:K23Other TypeColor scaleNO
K18:K23Other TypeColor scaleNO
K18:K23Other TypeColor scaleNO
K18:K23Other TypeColor scaleNO
K18:K23Other TypeColor scaleNO
I18:I23Other TypeColor scaleNO
I18:I23Other TypeColor scaleNO
I18:I23Other TypeColor scaleNO
I18:I23Other TypeColor scaleNO
I18:I23Other TypeColor scaleNO
I18:I23Other TypeColor scaleNO
I18:I23Other TypeColor scaleNO
I18:I23Other TypeColor scaleNO
I18:I23Other TypeColor scaleNO
I18:I23Cell Value=1textNO
K18:K23Other TypeColor scaleNO
K18:K23Other TypeColor scaleNO
K18:K23Other TypeColor scaleNO
K18:K23Cell Value=1textNO
M18:M23Other TypeColor scaleNO
M18:M23Other TypeColor scaleNO
M18:M23Other TypeColor scaleNO
M18:M23Cell Value=1textNO
O18:O23Other TypeColor scaleNO
O18:O23Other TypeColor scaleNO
O18:O23Other TypeColor scaleNO
O18:O23Cell Value=1textNO
Q18:Q23Other TypeColor scaleNO
Q18:Q23Other TypeColor scaleNO
Q18:Q23Other TypeColor scaleNO
Q18:Q23Cell Value=1textNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Other TypeColor scaleNO
I29Cell Value=1textNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Other TypeColor scaleNO
K29Cell Value=1textNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Other TypeColor scaleNO
M29Cell Value=1textNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Other TypeColor scaleNO
O29Cell Value=1textNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Other TypeColor scaleNO
Q29Cell Value=1textNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Other TypeColor scaleNO
I24Cell Value=1textNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Other TypeColor scaleNO
K24Cell Value=1textNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Other TypeColor scaleNO
M24Cell Value=1textNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Other TypeColor scaleNO
O24Cell Value=1textNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Other TypeColor scaleNO
Q24Cell Value=1textNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Other TypeColor scaleNO
I26:I28Cell Value=1textNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Other TypeColor scaleNO
K26:K28Cell Value=1textNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Other TypeColor scaleNO
M26:M28Cell Value=1textNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Other TypeColor scaleNO
O26:O28Cell Value=1textNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Other TypeColor scaleNO
Q26:Q28Cell Value=1textNO
I4:I16Other TypeColor scaleNO
I4:I16Other TypeColor scaleNO
I4:I16Other TypeColor scaleNO
I4:I16Other TypeColor scaleNO
I4:I16Other TypeColor scaleNO
I4:I16Other TypeColor scaleNO
I4:I16Other TypeColor scaleNO
I4:I16Other TypeColor scaleNO
I4:I16Other TypeColor scaleNO
I4:I16Cell Value=1textNO
K4:K16Other TypeColor scaleNO
K4:K16Other TypeColor scaleNO
K4:K16Other TypeColor scaleNO
K4:K16Other TypeColor scaleNO
K4:K16Other TypeColor scaleNO
K4:K16Other TypeColor scaleNO
K4:K16Other TypeColor scaleNO
K4:K16Other TypeColor scaleNO
K4:K16Other TypeColor scaleNO
K4:K16Cell Value=1textNO
M4:M16Other TypeColor scaleNO
M4:M16Other TypeColor scaleNO
M4:M16Other TypeColor scaleNO
M4:M16Other TypeColor scaleNO
M4:M16Other TypeColor scaleNO
M4:M16Other TypeColor scaleNO
M4:M16Other TypeColor scaleNO
M4:M16Other TypeColor scaleNO
M4:M16Other TypeColor scaleNO
M4:M16Cell Value=1textNO
O4:O16Other TypeColor scaleNO
O4:O16Other TypeColor scaleNO
O4:O16Other TypeColor scaleNO
O4:O16Other TypeColor scaleNO
O4:O16Other TypeColor scaleNO
O4:O16Other TypeColor scaleNO
O4:O16Other TypeColor scaleNO
O4:O16Other TypeColor scaleNO
O4:O16Other TypeColor scaleNO
O4:O16Cell Value=1textNO
Q4:Q16Other TypeColor scaleNO
Q4:Q16Other TypeColor scaleNO
Q4:Q16Other TypeColor scaleNO
Q4:Q16Other TypeColor scaleNO
Q4:Q16Other TypeColor scaleNO
Q4:Q16Other TypeColor scaleNO
Q4:Q16Other TypeColor scaleNO
Q4:Q16Other TypeColor scaleNO
Q4:Q16Other TypeColor scaleNO
Q4:Q16Cell Value=1textNO
I31:I41Other TypeColor scaleNO
I31:I41Other TypeColor scaleNO
I31:I41Other TypeColor scaleNO
I31:I41Other TypeColor scaleNO
I31:I41Other TypeColor scaleNO
I31:I41Other TypeColor scaleNO
I31:I41Other TypeColor scaleNO
I31:I41Other TypeColor scaleNO
I31:I41Other TypeColor scaleNO
I31:I41Cell Value=1textNO
K31:K41Other TypeColor scaleNO
K31:K41Other TypeColor scaleNO
K31:K41Other TypeColor scaleNO
K31:K41Other TypeColor scaleNO
K31:K41Other TypeColor scaleNO
K31:K41Other TypeColor scaleNO
K31:K41Other TypeColor scaleNO
K31:K41Other TypeColor scaleNO
K31:K41Other TypeColor scaleNO
K31:K41Cell Value=1textNO
M31:M41Other TypeColor scaleNO
M31:M41Other TypeColor scaleNO
M31:M41Other TypeColor scaleNO
M31:M41Other TypeColor scaleNO
M31:M41Other TypeColor scaleNO
M31:M41Other TypeColor scaleNO
M31:M41Other TypeColor scaleNO
M31:M41Other TypeColor scaleNO
M31:M41Other TypeColor scaleNO
M31:M41Cell Value=1textNO
O31:O41Other TypeColor scaleNO
O31:O41Other TypeColor scaleNO
O31:O41Other TypeColor scaleNO
O31:O41Other TypeColor scaleNO
O31:O41Other TypeColor scaleNO
O31:O41Other TypeColor scaleNO
O31:O41Other TypeColor scaleNO
O31:O41Other TypeColor scaleNO
O31:O41Other TypeColor scaleNO
O31:O41Cell Value=1textNO
Q31:Q41Other TypeColor scaleNO
Q31:Q41Other TypeColor scaleNO
Q31:Q41Other TypeColor scaleNO
Q31:Q41Other TypeColor scaleNO
Q31:Q41Other TypeColor scaleNO
Q31:Q41Other TypeColor scaleNO
Q31:Q41Other TypeColor scaleNO
Q31:Q41Other TypeColor scaleNO
Q31:Q41Other TypeColor scaleNO
Q31:Q41Cell Value=1textNO
 
Upvote 0
Before trying this macro, delete all the rows that contain the year 2025 in the date in column B on Sheet2. Then on Sheet1, re-enter the dates that contain the year 2025 in column B. You should be aware that the current macro will not recognize four quarters for 2025. All rows containing 2025 will be placed in the 5th quarter regardless of the month. You might consider using a separate file for each year if that works for you. In this manner, all rows will be placed in their appropriate quarters.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Target.Column <> 2 Then Exit Sub
    Application.ScreenUpdating = False
    Dim proj As Range, fnd As Range, desWS As Worksheet, Val As String, x As Long
    Set desWS = Sheets("Sheet2")
    Select Case True
        Case Target >= DateSerial(Year(Date) + 1, 1, 1)
            Val = "5th"
        Case Target >= DateSerial(Year(Target), 1, 1) And Target <= DateSerial(Year(Target), 3, 31)
            Val = "1st"
        Case Target >= DateSerial(Year(Target), 4, 1) And Target <= DateSerial(Year(Target), 6, 30)
            Val = "2nd"
        Case Target >= DateSerial(Year(Target), 7, 1) And Target <= DateSerial(Year(Target), 9, 30)
            Val = "3rd"
        Case Target >= DateSerial(Year(Target), 10, 1) And Target <= DateSerial(Year(Target), 12, 31)
            Val = "4th"
    End Select
    With desWS
        Set proj = .Range("A:A").Find(Target.Offset(, -1), LookIn:=xlValues, lookat:=xlWhole)
        If proj Is Nothing Then
            Set fnd = .Range("G:G").Find(Val, LookIn:=xlValues, lookat:=xlPart)
            .Rows(fnd.Row + 1).EntireRow.Insert
            .Rows(fnd.Row + 1).Interior.ColorIndex = xlNone
            Range("A" & Target.Row).Resize(, 4).Copy .Range("A" & fnd.Row + 1)
            Range("G" & Target.Row).Copy .Range("G" & fnd.Row + 1)
            .Range("D" & fnd.Row + 1).HorizontalAlignment = xlCenter
            x = .Range("A" & fnd.Row + 1 & ":A" & .Rows.Count).Cells.SpecialCells(xlCellTypeBlanks).Row - 1
            With desWS.Sort
                .SortFields.Clear
                .SortFields.Add Key:=Range("A" & fnd.Row + 1 & ":A" & x), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
                .SetRange Range("A" & fnd.Row + 1 & ":Q" & x)
                .Header = xlNo
                .MatchCase = False
                .Orientation = xlTopToBottom
                .SortMethod = xlPinYin
                .Apply
            End With
        Else
            Range("A" & Target.Row).Resize(, 4).Copy .Range("A" & proj.Row)
            Range("G" & Target.Row).Copy .Range("G" & proj.Row)
            .Range("D" & proj.Row).HorizontalAlignment = xlCenter
        End If
    End With
    Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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