Dear Sir
File Enclosed, it has two sheets "DC" and "DC Records"
Getting some error on "save records" button, it is not copying UOM and quantities, also pasting my code below;
File Enclosed, it has two sheets "DC" and "DC Records"
Getting some error on "save records" button, it is not copying UOM and quantities, also pasting my code below;
Code:
Sub Save_Data()
Dim rng As Range
Dim i As Long
Dim a As Long
Dim rng_dest As Range
Application.ScreenUpdating = False
i = 1
Set rng_dest = Sheets("DC Record").Range("E:G")
' Find first empty row in columns E:G on sheet DC Record
Do Until WorksheetFunction.CountA(rng_dest.Rows(i)) = 0
i = i + 1
Loop
'Copy range C13:I23 on sheet DC to Variant array
Set rng = Sheets("DC").Range("C13:I23")
' Copy rows containing values to sheet DC Record
For a = 1 To rng.Rows.Count
If WorksheetFunction.CountA(rng.Rows(a)) <> 0 Then
rng_dest.Rows(i).Value = rng.Rows(a).Value
'Copy DC number
Sheets("DC Record").Range("A" & i).Value = Sheets("DC").Range("I5").Value
'Copy Date
Sheets("DC Record").Range("B" & i).Value = Sheets("DC").Range("C5").Value
'Copy Customer
Sheets("DC Record").Range("C" & i).Value = Sheets("DC").Range("D7").Value
'Copy P.O number
Sheets("DC Record").Range("D" & i).Value = Sheets("DC").Range("H7").Value
i = i + 1
End If
Next a
Application.ScreenUpdating = True
End Sub