I want to copy data from one workbook to another by comparing current system date.
Billings ECCS
is the file I want to copy my data from to other workbook called New
, and the worksheet is called Billing Details
.
I want to copy only those data which belong to the current date of system. The Billing ECCS
workbook contains worksheet called Billing List
in which the first column is Date of Entry
.
I want to compare that date with the systems current date and then copy the corresponding data to the other worksheet by finding the next empty row.
Option Explicit
Sub SendToBilling()
Option Explicit
Sub Macro2()
Dim LastRow As Long
Dim eRow As Long
Dim i As Long
Dim wbMaster As Workbook
Set wbMaster = Workbooks.Open("file:///C:\Users\mrisingh\Desktop\Billing.xlsx")
With wbMaster.Worksheets("Billing Sheet")
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If Cells(i, 1) = Date Then
Range(Cells(i, 1), Cells(i, 6)).Select
Selection.Copy
eRow = Worksheets("Billing Details").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Cells(eRow, 1).Select
ActiveSheet.Paste
End If
Next i
End With
End Sub