Computing.Net > Forums > Office Software > button in excel

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

button in excel

Reply to Message Icon

Name: hojjo
Date: February 15, 2009 at 15:10:56 Pacific
OS: Windows XP
Subcategory: Microsoft Office
Comment:

i want to create a button in excel that will clear the contents of the row without deleting the formulas



Sponsored Link
Ads by Google

Response Number 1
Name: DerbyDad03
Date: February 15, 2009 at 16:15:14 Pacific
Reply:

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?


0

Response Number 2
Name: hojjo
Date: February 15, 2009 at 16:52:00 Pacific
Reply:

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


0

Response Number 3
Name: DerbyDad03
Date: February 15, 2009 at 17:12:04 Pacific
Reply:

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".


0

Response Number 4
Name: hojjo
Date: February 15, 2009 at 19:18:05 Pacific
Reply:

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.


0

Response Number 5
Name: DerbyDad03
Date: February 15, 2009 at 19:53:24 Pacific
Reply:

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
 Rows(MyRow).EntireRow.ClearContents
End Sub


0

Related Posts

See More



Response Number 6
Name: hojjo
Date: February 15, 2009 at 21:35:34 Pacific
Reply:

Thank you very much I like how that works and appears


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: button in excel

Print button in excel www.computing.net/answers/office/print-button-in-excel/8213.html

Buttons in Excel www.computing.net/answers/office/buttons-in-excel/3636.html

Buttons in Excel www.computing.net/answers/office/buttons-in-excel/4315.html