VBA CODE TO CLEAR ENTIRESHEET code example

Example 1: vba clear a worksheet

'VBA methods to quickly clear a sheet.

'Remove values 
'but not formatting:
Sheet1.UsedRange.ClearContents

'Remove formatting
'but not values:
Sheet1.UsedRange.ClearFormats

'Remove everything:
Sheet1.UsedRange.Clear

'Remove everything potentially faster:
Sheet1.UsedRange.Delete

'Remove everything, fastest:
With Application
	.Calculation = xlManual
    .ScreenUpdating = False
    
    Sheet1.UsedRange.Delete
    
    .ScreenUpdating = True
    .Calculation = xlAutomatic
End With

Example 2: excel vba quickest way to clear sheet contents

'VBA methods to quickly clear a sheet.

'Remove values 
'but not formatting:
Sheet1.UsedRange.ClearContents

'Remove formatting
'but not values:
Sheet1.UsedRange.ClearFormats

'Remove everything:
Sheet1.UsedRange.Clear

'Remove everything potentially faster:
Sheet1.UsedRange.Delete

'Remove everything, fastest:
With Application
	.Calculation = xlManual
    .ScreenUpdating = False
    
    Sheet1.UsedRange.Delete
    
    .ScreenUpdating = True
    .Calculation = xlAutomatic
End With

Tags:

Vb Example