ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   List box VBA script to clear cell in other sheet. (https://www.excelbanter.com/excel-programming/366114-list-box-vba-script-clear-cell-other-sheet.html)

Calle

List box VBA script to clear cell in other sheet.
 
Hi!
I have a vba script that I use for the option "clear cell" from a list box.
Now I want it to be able to clear cells in other sheets aswell. My script
looks like this:


If LCase(.Value) = LCase("clear choices") Then
Selection.Offset(1, -2).ClearContents
Selection.Offset(0, 0).ClearContents
etc....

Gary Brown

List box VBA script to clear cell in other sheet.
 
worksheets("MySheet").range("A1").offset(1,-2).clearcontents

HTH,
--
Gary Brown

If this post was helpful to you, please select 'YES' at the bottom of the
post.



"Calle" wrote:

Hi!
I have a vba script that I use for the option "clear cell" from a list box.
Now I want it to be able to clear cells in other sheets aswell. My script
looks like this:


If LCase(.Value) = LCase("clear choices") Then
Selection.Offset(1, -2).ClearContents
Selection.Offset(0, 0).ClearContents
etc....


worksheets("MySheet").range("A1").offset(1,-2).clearcontents

Calle

List box VBA script to clear cell in other sheet.
 
thanks for your help. I will try it when I come home :)

Calle

List box VBA script to clear cell in other sheet.
 
thx gary, it worked great.


All times are GMT +1. The time now is 12:19 AM.

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