Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
YMC YMC is offline
external usenet poster
 
Posts: 11
Default clear button

Is it possible to make a button clear certain cells. i want a button that
will clear F6:G22 and K6:K17
i am not to sure how to put together the code. could someone please give me
an example? thankyou
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default clear button

View Toolbars Forms

click on the button icon and put a button on the worksheet. When the Assign
Macro dialog box appears, select new and enter:

Sub Button1_Click()
Range("F6:G22", "K6:K17").Clear
End Sub
--
Gary''s Student - gsnu200770


"YMC" wrote:

Is it possible to make a button clear certain cells. i want a button that
will clear F6:G22 and K6:K17
i am not to sure how to put together the code. could someone please give me
an example? thankyou

  #3   Report Post  
Posted to microsoft.public.excel.programming
YMC YMC is offline
external usenet poster
 
Posts: 11
Default clear button


Sub Button1_Click()
Range("F6:G22", "K6:K17").Clear
End Sub



the only problem with this is that it completely clears everything. i just
want it to clear the information in the cells, and leave the color and
formats
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default clear button

use
Range("F6:G22", "K6:K17").ClearContents
instead of
Range("F6:G22", "K6:K17").Clear
--
Gary''s Student - gsnu200770


"YMC" wrote:


Sub Button1_Click()
Range("F6:G22", "K6:K17").Clear
End Sub



the only problem with this is that it completely clears everything. i just
want it to clear the information in the cells, and leave the color and
formats

  #5   Report Post  
Posted to microsoft.public.excel.programming
YMC YMC is offline
external usenet poster
 
Posts: 11
Default clear button



"Gary''s Student" wrote:

use
Range("F6:G22", "K6:K17").ClearContents
instead of
Range("F6:G22", "K6:K17").Clear

that works great accept it is clearing everything in between H-J column.
just want what i specified in F, G, and K cloumn i just want the specified
cells to clear


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default clear button

Activesheet.Range("F6:G22,K6:K17").ClearContents

(I like to qualify my ranges, too.)

YMC wrote:

"Gary''s Student" wrote:

use
Range("F6:G22", "K6:K17").ClearContents
instead of
Range("F6:G22", "K6:K17").Clear

that works great accept it is clearing everything in between H-J column.
just want what i specified in F, G, and K cloumn i just want the specified
cells to clear


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
YMC YMC is offline
external usenet poster
 
Posts: 11
Default clear button



"Dave Peterson" wrote:

Activesheet.Range("F6:G22,K6:K17").ClearContents

(I like to qualify my ranges, too.)


That works perfect! thankyou very much
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
Clear button vdmbqb Excel Discussion (Misc queries) 5 April 6th 08 04:21 PM
Create a Clear button to clear unprotected cells Jcraig713 Excel Programming 2 November 26th 07 03:55 PM
excel clear button vdmbqb Excel Worksheet Functions 1 November 24th 07 08:33 PM
clear button vdmbqb Excel Discussion (Misc queries) 1 November 24th 07 04:52 PM
Clear Button JudyP Excel Discussion (Misc queries) 2 August 5th 06 08:01 PM


All times are GMT +1. The time now is 03:04 PM.

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

About Us

"It's about Microsoft Excel"