jensAThome
Technical User
- Jul 12, 2007
- 4
I am currently testing some code that was previously running very well in MS Excel 2003 and earlier. However using the same code in Excel 2007 runs very slow. I narrowed it down to this command. Is there a better way to delete content? Or is this a setup problem?
Code:
Sub delete_my_content(sheet_name As String, x, y, dx, dy As Integer)
Dim error_string As String
On Error GoTo errorhandler
Sheets(sheet_name).Select
Sheets(sheet_name).Cells(x, y).Resize(dx, dy).Select
Selection.ClearContents
Exit Sub
errorhandler:
Any suggestions welcome
Code:
Sub delete_my_content(sheet_name As String, x, y, dx, dy As Integer)
Dim error_string As String
On Error GoTo errorhandler
Sheets(sheet_name).Select
Sheets(sheet_name).Cells(x, y).Resize(dx, dy).Select
Selection.ClearContents
Exit Sub
errorhandler:
Any suggestions welcome