Hi Nagul1!
Please try this code below:
Sub CutAndPaste()
Dim wsSource As Worksheet
Dim wsNew As Worksheet
Dim lastRow As Long
Dim lastCol As Long
Dim pasteRange As Range
'Set the source worksheet to the last sheet in the workbook
Set wsSource = ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)
'Find the last row and last column with data in the source worksheet
lastRow = wsSource.Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious). Row
lastCol = wsSource.Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious). Column
'Create a new worksheet for the cut and pasted data
Set wsNew = ThisWorkbook.Worksheets.Add(After:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count))
'Cut and paste the data from the source worksheet to the new worksheet
wsSource.Range("B6", wsSource.Cells(lastRow, lastCol)). Cut wsNew.Range("A1")
'Set the paste range in the source worksheet
Set pasteRange = wsSource.Range("B6", wsSource.Cells(lastRow, lastCol))
'Unprotect the source worksheet to allow pasting
wsSource.Unprotect
'Paste the data back into the source worksheet
pasteRange.Value = wsNew.Range("A1", wsNew.Cells(lastRow - 5, lastCol)). Value
'Protect the source worksheet again
wsSource.Protect
'Delete the new worksheet
Application.DisplayAlerts = False
wsNew.Delete
Application.DisplayAlerts = True
End Sub
This should create a new worksheet with the data you want to clean up, paste the cleaned data back into the original sheet, and delete the temporary worksheet.
Kindly let me know, if you require additional assistance, I will be glad to help further.
Best Regards,
Shakiru