Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / June 2007

Tip: Looking for answers? Try searching our database.

Clear cell numbers using a macro - Help!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CAM - 28 Jun 2007 02:54 GMT
Hello,

Thanks for Dave Peterson help I was able to to create a macro that will
clear the numbers only on the sheet, but not the formulas, below is a sample
of my code. Here is my problem I was able to clear the cells in the column -
numbers only not formulas, lets say column D, unfortuantely when I ran the
macro column C also clears, which has numbers too, but I don't want it to be
clear only column D, I selected column D to clear.  How can I stop clearing
column C?  any tips will be appreicated.  Thank you in advance.

Cheers

Private Sub cmdClear_Click()

'Select sheet and cell range to clear inputted cells.
           Sheets("Audits).Select
           Range("A14:F88").Select

'Select cell type constants - inputted cells only.
           Selection.SpecialCells(xlCellTypeConstants, 1).Select

'Clear cells
           Selection.ClearContents

End Sub
Dave Peterson - 28 Jun 2007 03:22 GMT
Maybe...

Option explicit
Private Sub cmdClear_Click()
on error resume next
worksheets("Audits).Range("A14:F88").SpecialCells(xlCellTypeConstants, 1) _
      .ClearContents
on error goto 0
End Sub

> Hello,
>
[quoted text clipped - 21 lines]
>
> End Sub

Signature

Dave Peterson

CAM - 28 Jun 2007 04:10 GMT
Hey Dave,

Works like a charm.  Thanks for your help.

Cheers

> Maybe...
>
[quoted text clipped - 37 lines]
>>
>> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.