Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Data Validation and a Clear Button

Hi,

I'm not very knowledgeable on codes and all that intails. What I'm
trying to do with Microsoft Excel is create a spreadsheet using data
validation. I've gotten that part complete. Now what i'm trying to
do is add a "Clear" button so that the drop down data validation cells/
menus will remain intact but the clear button will turn the cells
blank so that the input user will be able to start over with the drop
down menus. Hope this makes sense. Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Data Validation and a Clear Button

Open the control toolbox and add a command button to your worksheet.
Then right-click your sheet tab, hit View Code and add this:

Private Sub CommandButton1_Click()
Cells.ClearContents
End Sub

--
Dan

On Dec 31, 11:05*am, wrote:
Hi,

* *I'm not very knowledgeable on codes and all that intails. *What I'm
trying to do with Microsoft Excel is create a spreadsheet using data
validation. *I've gotten that part complete. *Now what i'm trying to
do is add a "Clear" button so that the drop down data validation cells/
menus will remain intact but the clear button will turn the cells
blank so that the input user will be able to start over with the drop
down menus. *Hope this makes sense. *Thanks for any help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Data Validation and a Clear Button

On Dec 31, 12:25*pm, "Dan R." wrote:
Open the control toolbox and add a command button to your worksheet.
Then right-click your sheet tab, hit View Code and add this:

Private Sub CommandButton1_Click()
* *Cells.ClearContents
End Sub

--
Dan

On Dec 31, 11:05*am, wrote:

Dan, thanks for helping...I'm still not getting it to work. Here is the entire "Code" that I have now and its still showing errors, hopefully you can show me whats wrong.


Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Private Sub CommandButton1_Click()
Cells.ClearContents
End Sub

End Sub

Also, once this works is this code designed to clear all my cells or
just the ones with Data validation? Thats all I'm trying to do is
clear them not my titles, sub headings etc. Thanks a million

Hi,


* *I'm not very knowledgeable on codes and all that intails. *What I'm
trying to do with Microsoft Excel is create a spreadsheet using data
validation. *I've gotten that part complete. *Now what i'm trying to
do is add a "Clear" button so that the drop down data validation cells/
menus will remain intact but the clear button will turn the cells
blank so that the input user will be able to start over with the drop
down menus. *Hope this makes sense. *Thanks for any help.- Hide quoted text -


- Show quoted text -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Data Validation and a Clear Button

First,
Cells.clearcontents
will clear all the cells on the worksheet. I'm not sure that's what you want!

Second, you don't want the other stuff--just this:
Private Sub CommandButton1_Click()
me.range("a1,b3,d3,e9:f10").ClearContents
End Sub

Change that a1,b3,d3,e9:f10 stuff to just the addresses that should be cleared.

wrote:

On Dec 31, 12:25 pm, "Dan R." wrote:
Open the control toolbox and add a command button to your worksheet.
Then right-click your sheet tab, hit View Code and add this:

Private Sub CommandButton1_Click()
Cells.ClearContents
End Sub

--
Dan

On Dec 31, 11:05 am, wrote:

Dan, thanks for helping...I'm still not getting it to work. Here is the entire "Code" that I have now and its still showing errors, hopefully you can show me whats wrong.


Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Private Sub CommandButton1_Click()
Cells.ClearContents
End Sub

End Sub

Also, once this works is this code designed to clear all my cells or
just the ones with Data validation? Thats all I'm trying to do is
clear them not my titles, sub headings etc. Thanks a million

Hi,


I'm not very knowledgeable on codes and all that intails. What I'm
trying to do with Microsoft Excel is create a spreadsheet using data
validation. I've gotten that part complete. Now what i'm trying to
do is add a "Clear" button so that the drop down data validation cells/
menus will remain intact but the clear button will turn the cells
blank so that the input user will be able to start over with the drop
down menus. Hope this makes sense. Thanks for any help.- Hide quoted text -


- Show quoted text -


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Data Validation and a Clear Button

On Dec 31, 1:45*pm, Dave Peterson wrote:
First,
Cells.clearcontents
will clear all the cells on the worksheet. *I'm not sure that's what you want!

Second, you don't want the other stuff--just this:
Private Sub CommandButton1_Click()
* *me.range("a1,b3,d3,e9:f10").ClearContents
End Sub

Change that a1,b3,d3,e9:f10 stuff to just the addresses that should be cleared.





wrote:

On Dec 31, 12:25 pm, "Dan R." wrote:
Open the control toolbox and add a command button to your worksheet.
Then right-click your sheet tab, hit View Code and add this:


Private Sub CommandButton1_Click()
* *Cells.ClearContents
End Sub


--
Dan


On Dec 31, 11:05 am, wrote:


Dan, thanks for helping...I'm still not getting it to work. *Here is the entire "Code" that I have now and its still showing errors, hopefully you can show me whats wrong.


Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Private Sub CommandButton1_Click()
* *Cells.ClearContents
End Sub


End Sub


Also, once this works is this code designed to clear all my cells or
just the ones with Data validation? *Thats all I'm trying to do is
clear them not my titles, sub headings etc. *Thanks a million


Hi,


* *I'm not very knowledgeable on codes and all that intails. *What I'm
trying to do with Microsoft Excel is create a spreadsheet using data
validation. *I've gotten that part complete. *Now what i'm trying to
do is add a "Clear" button so that the drop down data validation cells/
menus will remain intact but the clear button will turn the cells
blank so that the input user will be able to start over with the drop
down menus. *Hope this makes sense. *Thanks for any help.- Hide quoted text -


- Show quoted text -


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Ok, no errors after I inserted that code. However now when I go to
"click" on the command button, my pointer turns into a fourway arrow
and it just wants me to "move" the button not actually press it to
clear. Any help with this problem?


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Data Validation and a Clear Button

And make sure you've allowed macros to run--you may need to change the security
setting and/or answer the prompt when the workbook is opened.

wrote:

On Dec 31, 1:45 pm, Dave Peterson wrote:
First,
Cells.clearcontents
will clear all the cells on the worksheet. I'm not sure that's what you want!

Second, you don't want the other stuff--just this:
Private Sub CommandButton1_Click()
me.range("a1,b3,d3,e9:f10").ClearContents
End Sub

Change that a1,b3,d3,e9:f10 stuff to just the addresses that should be cleared.





wrote:

On Dec 31, 12:25 pm, "Dan R." wrote:
Open the control toolbox and add a command button to your worksheet.
Then right-click your sheet tab, hit View Code and add this:


Private Sub CommandButton1_Click()
Cells.ClearContents
End Sub


--
Dan


On Dec 31, 11:05 am, wrote:


Dan, thanks for helping...I'm still not getting it to work. Here is the entire "Code" that I have now and its still showing errors, hopefully you can show me whats wrong.


Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Private Sub CommandButton1_Click()
Cells.ClearContents
End Sub


End Sub


Also, once this works is this code designed to clear all my cells or
just the ones with Data validation? Thats all I'm trying to do is
clear them not my titles, sub headings etc. Thanks a million


Hi,


I'm not very knowledgeable on codes and all that intails. What I'm
trying to do with Microsoft Excel is create a spreadsheet using data
validation. I've gotten that part complete. Now what i'm trying to
do is add a "Clear" button so that the drop down data validation cells/
menus will remain intact but the clear button will turn the cells
blank so that the input user will be able to start over with the drop
down menus. Hope this makes sense. Thanks for any help.- Hide quoted text -


- Show quoted text -


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Ok, no errors after I inserted that code. However now when I go to
"click" on the command button, my pointer turns into a fourway arrow
and it just wants me to "move" the button not actually press it to
clear. Any help with this problem?


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Data Validation and a Clear Button

Make sure you have that code behind the worksheet that owns that commandbutton.

And make sure that you've toggled Design mode off.

It's a button on that same control toolbox toolbar.

wrote:

On Dec 31, 1:45 pm, Dave Peterson wrote:
First,
Cells.clearcontents
will clear all the cells on the worksheet. I'm not sure that's what you want!

Second, you don't want the other stuff--just this:
Private Sub CommandButton1_Click()
me.range("a1,b3,d3,e9:f10").ClearContents
End Sub

Change that a1,b3,d3,e9:f10 stuff to just the addresses that should be cleared.





wrote:

On Dec 31, 12:25 pm, "Dan R." wrote:
Open the control toolbox and add a command button to your worksheet.
Then right-click your sheet tab, hit View Code and add this:


Private Sub CommandButton1_Click()
Cells.ClearContents
End Sub


--
Dan


On Dec 31, 11:05 am, wrote:


Dan, thanks for helping...I'm still not getting it to work. Here is the entire "Code" that I have now and its still showing errors, hopefully you can show me whats wrong.


Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Private Sub CommandButton1_Click()
Cells.ClearContents
End Sub


End Sub


Also, once this works is this code designed to clear all my cells or
just the ones with Data validation? Thats all I'm trying to do is
clear them not my titles, sub headings etc. Thanks a million


Hi,


I'm not very knowledgeable on codes and all that intails. What I'm
trying to do with Microsoft Excel is create a spreadsheet using data
validation. I've gotten that part complete. Now what i'm trying to
do is add a "Clear" button so that the drop down data validation cells/
menus will remain intact but the clear button will turn the cells
blank so that the input user will be able to start over with the drop
down menus. Hope this makes sense. Thanks for any help.- Hide quoted text -


- Show quoted text -


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Ok, no errors after I inserted that code. However now when I go to
"click" on the command button, my pointer turns into a fourway arrow
and it just wants me to "move" the button not actually press it to
clear. Any help with this problem?


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why the data validation button is greyed out when it is in trackchange mode in Excel 2007 [email protected] Excel Discussion (Misc queries) 0 May 16th 08 02:52 AM
Create a Clear button to clear unprotected cells Jcraig713 Excel Programming 2 November 26th 07 03:55 PM
Data validation dependent of value of option button [email protected] Excel Programming 1 June 9th 06 02:48 PM
Userforms submit button to clear after it enters data? carlaruge[_2_] Excel Programming 2 July 8th 05 01:50 AM
question data validation and delete/clear behavior Jeff Higgins Excel Programming 0 January 23rd 05 08:09 PM


All times are GMT +1. The time now is 11:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"