button in excel

February 15, 2009 at 15:10:56
Specs: Windows XP
i want to create a button in excel that will clear the contents of the row without deleting the formulas

See More: button in excel

Report •

February 15, 2009 at 16:15:14
I think we need a little more detail before we can help.

As per the VBA Help files, formulae are content.

ClearContents Method
Clears the formulas from the range. Clears the data from a chart but leaves the formatting.

What exactly are you trying accomplish?

Report •

February 15, 2009 at 16:52:00
We have a spreadsheet that oulines by program and color the parts that our required for shipment. When the quantities are satisfied, I want to be able to hit a clear button to the clear the contents of the specific row to be able to enter in new requirements. I have created a clear button but it is unique to that row. Do I need to create a separate macro for each row or can I create 1 macro that is "smart" to the row I create a button for. I am trying not to have to creat 50 individual macros to clear 50 different rows. Your ideas/help would be appreciated

Report •

February 15, 2009 at 17:12:04
You can create one button that will clear the currently selected row (or row that the currently selected cell is in), or you could create a button that asks you what row to clear or you could create a button to search for user-entered text and then clear that row, like a part number or etc. etc. You could even create a button that will clear only specific cells in a row.

The possibilites are almost endless, some are just more complicated than others.

However, your second post still doesn't clarify your original request: "clear the contents of the row without deleting the formulas".

Report •

Related Solutions

February 15, 2009 at 19:18:05
disregard my first question Im beginning to understand the premise about clearing.You are deleting the text, not the cells. Thanks for the suggestions. How would I go about creating a button to ask what row I wanted to clear.

Report •

February 15, 2009 at 19:53:24
You would use the InputBox method. This is not something you can record, you have to either write the code from scratch or modify code created by the recorder.

Here is a simple example. Paste the code into a VBA editor window, place your cursor on the word InputBox and hit F1. This will open the help window for the InputBox method and explain how it works.

Sub ClearMyRow()
'Get Row Number
 MyRow = Application.InputBox("What Row Number Do You Want to Clear?", "My Row Clearer", Type:=1)
'Close Box If User Cancels
 If MyRow = False Then Exit Sub
'Clear the Row
End Sub

Report •

February 15, 2009 at 21:35:34
Thank you very much I like how that works and appears

Report •

Ask Question