ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Restore a range of cells to "empty"? (https://www.excelbanter.com/excel-programming/443658-restore-range-cells-empty.html)

Robert Crandal[_2_]

Restore a range of cells to "empty"?
 
One of my sheets is originally empty, but my user will sometimes
paste a group of data to fill the range of A1:H17. Or, they might
also run a macro which dumps data from an ADO Recordset
object that fills the range A1:H17.

How do I restore my range (A1:H17) back to its original empty
state after any of the above operations occur? (How do I do
this using VBA code for Excel 2007?)

Thank you!



Don Guillett Excel MVP

Restore a range of cells to "empty"?
 
On Sep 26, 5:25*am, "Robert Crandal" wrote:
One of my sheets is originally empty, but my user will sometimes
paste a group of data to fill the range of A1:H17. * Or, they might
also run a macro which dumps data from an ADO Recordset
object that fills the range A1:H17.

How do I restore my range (A1:H17) back to its original empty
state after any of the above operations occur? *(How do I do
this using VBA code for Excel 2007?)

Thank you!


Manually: Select the range and touch the delete key
Macro:
sub clearcells()
range("a1:h17").clear
end sub


All times are GMT +1. The time now is 06:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com