ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do i create a button to clear a value field i created? (https://www.excelbanter.com/excel-programming/340849-how-do-i-create-button-clear-value-field-i-created.html)

sofodile

how do i create a button to clear a value field i created?
 
i created a field in which you can enter values in different spaces and it
will calculate, these number accordingly.... how do i create a button to
clear the values inputed, so that the "calculator" can be used again

Jim Thomlinson[_4_]

how do i create a button to clear a value field i created?
 
You can try something like this

Public Sub ClearData()
On Error Goto ErrorHandler:
Application.Calculation = xlManual
With Sheets("Sheet1")
.Range("A1").ClearContents
.Range("B2").ClearContents
.Range("C3").ClearContents
.Range("D4").ClearContents
End With
ErrorHandler:
Application.Calculation = xlAutomatic
End Sub

Place this in a module and add a button from the forms toolbar. Select this
macro when propted to do so and...
--
HTH...

Jim Thomlinson


"sofodile" wrote:

i created a field in which you can enter values in different spaces and it
will calculate, these number accordingly.... how do i create a button to
clear the values inputed, so that the "calculator" can be used again



All times are GMT +1. The time now is 07:24 AM.

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