Hi ExcelForum Members,
Please help me. I have worksheets:
w1:= "Sales and Inventory System"
w2:= "Sales Summary"
In w1, the user will encode the details of sales. If user clicked the botton "Record to Sales", the details of sales will be recorded at w2.
W2 is the record/log of sales.
Here's the sample of my code.
[CODE]
Sub sales()
Dim wb As Workbook, NR As Long
Dim lr As Long
Set wb = Workbooks.Open("C:\Users\jordas\Desktop\Programming\MerchadiseSystemSimpleSystem\SalesSummary.xlsx")
NR = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row + 1
lr = Range("a" & Rows.Count).End(xlUp).Row
With ThisWorkbook.Sheets("Sales")
For i = 15 To lr - 1
.Range("d5").Copy Destination:=wb.Sheets("Sheet1").Range("C" & NR)
.Range("d7").Copy Destination:=wb.Sheets("Sheet1").Range("D" & NR)
.Range("G5").Copy Destination:=wb.Sheets("Sheet1").Range("A" & NR)
.Range("G7").Copy Destination:=wb.Sheets("Sheet1").Range("B" & NR)
Cells(i, 3).Copy Destination:=wb.Sheets("Sheet1").Range("e" & NR)
Cells(i, 4).Copy Destination:=wb.Sheets("Sheet1").Range("f" & NR)
Cells(i, 5).Copy Destination:=wb.Sheets("Sheet1").Range("g" & NR)
Cells(i, 6).Copy Destination:=wb.Sheets("Sheet1").Range("h" & NR)
Cells(i, 7).Copy Destination:=wb.Sheets("Sheet1").Range("i" & NR)
Next i
End With
wb.Close savechanges:=True
End Sub
For a better view of my problem, i attached my files.
Thanks in advance!
Sales and Inventory System.xlsmSalesSummary.xlsx
Bookmarks