Good pm again mrexcel fans.
I need a code where:
If user wants to update the FIN_sheet (pic below with details), where it will insert to the due month base on the date type on TEMPLATE_sheet (C1) just like this sequence:
-User adds date to TEMPLATE_sheet C1 and clicks ADD PER DM
-Then it will populate to the same DATE but on the last part of the column (See FIN_sheet)
TEMPLATE_sheet without changes
TEMPLATE_sheet with changes see row 12-13 that will be the date to be transferred to FIN_sheet
FIN_sheet before
FIN_sheet after (data added on rows between 14-15)
---
The code currently on ADD DM
---
Sub DATA_DATE()
Dim wsData As Worksheet
Dim wsTemp As Worksheet
Dim v As Variant
Dim lr As Long
Dim r As Long
Application.ScreenUpdating = False
' Set worksheet variables
Set wsData = Sheets("TEMPLATE")
Set wsTemp = Sheets("FIN")
' Capture value to filter on
v = wsData.Range("A1")
dd = wsData.Range("C1")
' First clear range on TEMPLATE_SHEET
' wsTemp.Activate
' Rows("4:" & Rows.Count).Delete
' Find last row on DATA_SHEET
wsData.Activate
lr = Cells(Rows.Count, "B").End(xlUp).Row
' Loop through all rows on DATA_SHEET
For r = 1 To lr
' Check value in column A
If Cells(r, "B") = v And Cells(r, "A") = dd Then
' Copy columns B-D to TEMPLATE_SHEET
Range(Cells(r, "A"), Cells(r, "D")).Copy wsTemp.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
Range(Cells(r, "E"), Cells(r, "K")).Copy wsTemp.Cells(Rows.Count, "N").End(xlUp).Offset(1, 0)
Range(Cells(r, "L"), Cells(r, "M")).Copy wsTemp.Cells(Rows.Count, "X").End(xlUp).Offset(1, 0)
End If
Next r
'Call ADD_SEQ_01
Application.Wait (Now + TimeValue("00:00:01"))
'Call ADD_SEQ_02
Application.ScreenUpdating = True
wsTemp.Activate
MsgBox "ADDED_-WNDNCG"
End Sub
I need a code where:
If user wants to update the FIN_sheet (pic below with details), where it will insert to the due month base on the date type on TEMPLATE_sheet (C1) just like this sequence:
-User adds date to TEMPLATE_sheet C1 and clicks ADD PER DM
-Then it will populate to the same DATE but on the last part of the column (See FIN_sheet)
TEMPLATE_sheet without changes
TEMPLATE_sheet with changes see row 12-13 that will be the date to be transferred to FIN_sheet
FIN_sheet before
FIN_sheet after (data added on rows between 14-15)
---
The code currently on ADD DM
---
Sub DATA_DATE()
Dim wsData As Worksheet
Dim wsTemp As Worksheet
Dim v As Variant
Dim lr As Long
Dim r As Long
Application.ScreenUpdating = False
' Set worksheet variables
Set wsData = Sheets("TEMPLATE")
Set wsTemp = Sheets("FIN")
' Capture value to filter on
v = wsData.Range("A1")
dd = wsData.Range("C1")
' First clear range on TEMPLATE_SHEET
' wsTemp.Activate
' Rows("4:" & Rows.Count).Delete
' Find last row on DATA_SHEET
wsData.Activate
lr = Cells(Rows.Count, "B").End(xlUp).Row
' Loop through all rows on DATA_SHEET
For r = 1 To lr
' Check value in column A
If Cells(r, "B") = v And Cells(r, "A") = dd Then
' Copy columns B-D to TEMPLATE_SHEET
Range(Cells(r, "A"), Cells(r, "D")).Copy wsTemp.Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
Range(Cells(r, "E"), Cells(r, "K")).Copy wsTemp.Cells(Rows.Count, "N").End(xlUp).Offset(1, 0)
Range(Cells(r, "L"), Cells(r, "M")).Copy wsTemp.Cells(Rows.Count, "X").End(xlUp).Offset(1, 0)
End If
Next r
'Call ADD_SEQ_01
Application.Wait (Now + TimeValue("00:00:01"))
'Call ADD_SEQ_02
Application.ScreenUpdating = True
wsTemp.Activate
MsgBox "ADDED_-WNDNCG"
End Sub