Question : Copy and paste data if matched.

Hi Experts,

I would like to request Experts help to write a script to which is able to crosscheck Time (Column_A) in Reconcile sheet with Time (Column_B) in System Sheet. If matched, copy the matched row data of Column_B and C (System sheet) and paste it at Reconcile sheet (need to follow the time sequence).

I have manually copied few data for Experts to get better view. Hope Experts can help me to create this feature.


Attachments:
 
 

Answer : Copy and paste data if matched.

Sure
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
Sub Crosscheck()
Application.ScreenUpdating = False
Dim r As Range
Dim ws As Worksheet
Set ws = Worksheets("Reconcile")
Set r = ws.Range("B5", ws.Cells.SpecialCells(xlCellTypeLastCell)).EntireRow.Resize(, 1).Offset(, 1)
r.FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC[-1],System!C:C,1,FALSE)),"""",VLOOKUP(RC[-1],System!C:C,1,FALSE))"
r.Offset(, 1).FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC[-2],System!C[-1]:C,2,FALSE)),"""",VLOOKUP(RC[-2],System!C[-1]:C,2,FALSE))"
r.Resize(, 2).Copy
Application.DisplayAlerts = False
r.Resize(, 2).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Set r = ws.Range("B5", ws.Cells.SpecialCells(xlCellTypeLastCell)).EntireRow.Resize(, 1).Offset(, 1)
r.EntireRow.RowHeight = 15
r.Resize(, 1).Offset(, -1).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Random Solutions  
 
programming4us programming4us