ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Clear selection? (https://www.excelbanter.com/excel-programming/350028-clear-selection.html)

StargateFanFromWork[_3_]

Clear selection?
 
I've made do with using this for now:

ActiveCell.Offset(0, 0).Select

I'd found Selection.Clear, I believe it was, in the archives but when I
tested it, it literally wiped everything in the selection rather than just
removing the selection. In other words, even the conditional formatting was
removed, too. Is there something better than the above code, then, for
this? The above simplistic approach does the job, but it's probably a
ham-handed way of doing this.

Thanks! :oD



L. Howard Kittle

Clear selection?
 
You don't need to select to clear a cell or a range.

ActiveCell.Offset(0, 0).ClearContents

However, if you are setting row/column to 0 then just use

ActiveCell.ClearContents

HTH
Regards,
Howard

"StargateFanFromWork" wrote in message
...
I've made do with using this for now:

ActiveCell.Offset(0, 0).Select

I'd found Selection.Clear, I believe it was, in the archives but when I
tested it, it literally wiped everything in the selection rather than just
removing the selection. In other words, even the conditional formatting
was
removed, too. Is there something better than the above code, then, for
this? The above simplistic approach does the job, but it's probably a
ham-handed way of doing this.

Thanks! :oD






All times are GMT +1. The time now is 09:37 AM.

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