We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide
Excel Expert needed
melsmiff
Posts: 4 Newbie
in Techie Stuff
I am having probelsm with an excel spreadsheet and a clear all button I have created. I can get it to clear normal cells but cells which have scroll bars or option boxes do not clear, or those that have a yes/no list drop down box. Can anyone give me advice? I can send the file if need be as its kind of hard for me to explain!
0
Comments
-
So you have a Macro button that clears information within cells?
When you say you want to clear option boxes.. do you mean delete the option box or clear the information inside it?
Lets say the option box is called optionBox1. You would need to run a function to clear the entry of the option box... so
optionBox1[0] = ""
meaning the first entry in optionbox1 is "" i.e nothing. That code isn't exactly correct though (or it might be..).. but thats the type of thing you need to do to clear information WITHIN an object.[FONT=Arial, Helvetica, sans-serif]"The internet is a great way to get on the net."
- Bob Dole, Republican presidential candidate[/FONT]0 -
So if my option button is called OptionButton135_Click (I think?) then I would add the code:
Range("D7").Select
Selection.ClearContents
Range("D9").Select
Selection.ClearContents
Range("D11").Select
Selection.ClearContents
Range("D14").Select
Selection.ClearContents
Range("D26").Select
ActiveCell.FormulaR1C1 = "0"
Range("D7").Select
optionButton135_Click [0] = ""
End Sub0 -
You could make it a bit tidier by putting:
Range("D7").ClearcontentsCharlie0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
Categories
- All Categories
- 353.5K Banking & Borrowing
- 254.1K Reduce Debt & Boost Income
- 455K Spending & Discounts
- 246.6K Work, Benefits & Business
- 602.9K Mortgages, Homes & Bills
- 178.1K Life & Family
- 260.6K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards