hello
I try making macro to copy data from sheet "SALES" to sheet "DATA" but my code doesn't work as what I want I put the result in sheet data what code should do
so I truly appreciate if any body fixing my mistake
Sub J3v16()
Dim ws As Worksheet, nr As Long, lr As Long
Application.ScreenUpdating = False
Set ws = Sheets("sales")
With ws
lr = .Cells(.Rows.Count, 1).End(xlUp).Row
If lr > 22 Then
.Range("b23:g" & lr).Copy
With Sheets("Data ")
nr = .Cells(.Rows.Count, 2).End(xlUp).Row + 1
.Range("D" & nr).PasteSpecial xlPasteValues
.Range("A" & nr).Resize(lr - 22) = ws.Range("A23:A" & lr).Value
.Range("B" & nr).Resize(lr - 22, 2) = Array(ws.Range("F7"), ws.Range("F9"))
.Range("J" & nr).Value = Application.Sum(.Range("I" & nr).Resize(lr - 22))
.UsedRange.Borders.Weight = 2
.Columns(7).Resize(, 4).NumberFormat = "0.00"
End With
End If
End With
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub