i need help here . my PC memory ram usage starts to increases gradually after that sub is run, until it is used completely and the system crashes ,
the code only to copy range from sheet and paste to other sheet
i use windows 10 , and the ram is 16 and i try with 32 ram also the same issue happen to me
the code is here
Private Sub btnsave_Click()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim rng1 As Range, rng2 As Range
Set ws1 = ThisWorkbook.Sheets("main")
Set ws2 = ThisWorkbook.Sheets("Sor4main")
Set rng1 = Application.WorksheetFunction.XLookup(ws1.Range("E2"), ws1.Range("B:B"), ws1.Range("B:B").Offset(0, 1), "", 0, 1)
Set rng2 = ws2.Range("A3:CB3")
ws1.Activate
rng1.Activate
ActiveCell.Select
rng2.Copy
rng1.PasteSpecial xlPasteValues
Set ws1 = Nothing
Set ws2 = Nothing
Set rng1 = Nothing
Set rng2 = Nothing
Application.CutCopyMode = False
ThisWorkbook.Save
End Sub