I’m working with a macro excel. I’m trying to delete the formula but keep the values of the cells as it makes filtering/sorting so slow. I already tried the following:
Range("A2:E70000").Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _ SkipBlanks :=False, Transpose:=False
Sheet1.Range("A2:E70000").Values = Sheet1.Range("A2:E70000").Values
but both of them take too long to finish(about 30mins. to complete). Are there any faster ways to do this? Thanks in advance.
Bracket your code with
Application.ScreenUpdating = False
Application.creenUpdting = True
and you should see performance improve dramatically.
Visuals like selecting the cells are going to slow this down considerably. Also selecting to row 70,0000? If this is actually the case then fair enough, but if not then why?
Have edited your first code slightly. This will stop the screen updating until finished, won’t ‘select’ any cells (visually) and will find the last actual row that is in use instead of just blanket selecting a range in hope it gets everything.
Application.ScreenUpdating = False with Sheet1.Range("A2:E" & Sheet1.Range("E" & .Rows.Count).End(xlUp).Row) .copy .PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, _ SkipBlanks :=False, Transpose:=False end with Application.ScreenUpdating = True