#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear cells

How can I Clear range of cells (e.g. a1,,a10) using a command button on a
worksheet??? I want to use VBA.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Clear cells

Hitu, use this code for your command button

Range("A1:A10").ClearContents
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Hitu" wrote in message
...
How can I Clear range of cells (e.g. a1,,a10) using a command button on a
worksheet??? I want to use VBA.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Clear cells

make the control toolbox toolbar visible. Click on the commandbutton and
then rubberband its location on the worksheet. You will be in design mode.
Double click on the command button and you should see

Private Sub Commandbutton1_Click()

End Sub

in the procedure put your code

Private Sub Commandbutton1_Click()
Range("A1:A10").Clear
End Sub


go back to the worksheet (alt+F11),
then click the button on the upper left corner of the commandbar to get out
of design mode. Now click the button and it should clear the cells.
--
Regards,
Tom Ogilvy



"Hitu" wrote:

How can I Clear range of cells (e.g. a1,,a10) using a command button on a
worksheet??? I want to use VBA.

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
Cells.Clear Ben Dummar Excel Discussion (Misc queries) 3 January 24th 07 10:50 PM
clear contents cells of unprotected cells Ed Excel Programming 6 January 12th 06 06:09 PM
Clear Cells Mike Excel Discussion (Misc queries) 4 November 20th 05 11:50 PM
Clear cells with #N/A mthomas[_6_] Excel Programming 4 August 12th 05 04:24 PM
Clear cells range if certain cells are all empty gschimek - ExcelForums.com Excel Programming 6 May 13th 05 10:38 PM


All times are GMT +1. The time now is 01:20 AM.

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"