ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Delete contents in cells with macro (https://www.excelbanter.com/excel-discussion-misc-queries/129050-delete-contents-cells-macro.html)

dford

Delete contents in cells with macro
 
I would like to select any cell and delete the contents in that cell and 10
cells to the right of that cell. Can I create a macro to do that?

Gary''s Student

Delete contents in cells with macro
 
Sub dford()
Dim r As Range, r2 As Range

Set r2 = Selection
Set r = Range(r2, r2.Offset(0, 10))

r.Clear
End Sub

--
Gary''s Student
gsnu200703


"dford" wrote:

I would like to select any cell and delete the contents in that cell and 10
cells to the right of that cell. Can I create a macro to do that?


Don Guillett

Delete contents in cells with macro
 
Sub clearcells()
ActiveCell.Resize(1, 10).ClearContents
End Sub

--
Don Guillett
SalesAid Software

"dford" wrote in message
...
I would like to select any cell and delete the contents in that cell and 10
cells to the right of that cell. Can I create a macro to do that?




dford

Delete contents in cells with macro
 
Thanks for the help.

"Don Guillett" wrote:

Sub clearcells()
ActiveCell.Resize(1, 10).ClearContents
End Sub

--
Don Guillett
SalesAid Software

"dford" wrote in message
...
I would like to select any cell and delete the contents in that cell and 10
cells to the right of that cell. Can I create a macro to do that?





Don Guillett

Delete contents in cells with macro
 
Glad to help

--
Don Guillett
SalesAid Software

"dford" wrote in message
...
Thanks for the help.

"Don Guillett" wrote:

Sub clearcells()
ActiveCell.Resize(1, 10).ClearContents
End Sub

--
Don Guillett
SalesAid Software

"dford" wrote in message
...
I would like to select any cell and delete the contents in that cell and
10
cells to the right of that cell. Can I create a macro to do that?








All times are GMT +1. The time now is 10:55 AM.

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