PC Review


Reply
Thread Tools Rate Thread

clear contents

 
 
Joanne
Guest
Posts: n/a
 
      6th Jan 2008
WinXP Pro MSOffice2003

I recorded this macro to clear the contents of my ws before exiting. It
is attached to a button on the ws. Problem is, it clears my formulas
from the worksheet.
What changes do I need to make to get it to clear values and leave
formulas intact?

Public Sub Clear()
' Clear Worksheet values for next invoice

Rows("15:65").Select
Range("A65").Activate
Selection.ClearContents
End Sub

Thanks for the help - you guys are great
Joanne
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      6th Jan 2008
Joanne,

maybe this

Selection.SpecialCells(xlCellTypeConstants).Select
Selection.ClearContents

Try it on a non-critical sheet first.

Mike

"Joanne" wrote:

> WinXP Pro MSOffice2003
>
> I recorded this macro to clear the contents of my ws before exiting. It
> is attached to a button on the ws. Problem is, it clears my formulas
> from the worksheet.
> What changes do I need to make to get it to clear values and leave
> formulas intact?
>
> Public Sub Clear()
> ' Clear Worksheet values for next invoice
>
> Rows("15:65").Select
> Range("A65").Activate
> Selection.ClearContents
> End Sub
>
> Thanks for the help - you guys are great
> Joanne
>

 
Reply With Quote
 
Joanne
Guest
Posts: n/a
 
      6th Jan 2008
Thanks Mike
It cleared out all values and left my formulas.
Sweet

Can I ask another question please?

On my ws I am using only col A thru G. As I tab thru them to do data
input, when I am finished in G, tabbing takes me to the cols at the
right ad infinitum.
Is there a way to tell my ws when leaving col G, go to next row, Col A?

Thanks again Mike
Joanne

Mike H wrote:

> Selection.SpecialCells(xlCellTypeConstants).Select
> Selection.ClearContents


 
Reply With Quote
 
FSt1
Guest
Posts: n/a
 
      6th Jan 2008
hi
one way maybe
Range("A15:iv255").SpecialCells(xlCellTypeConstants) _
.ClearContents
another way surgical delete
RAnge"A15, B16,C17,D18:e20,ect,ect")

you would have to list all of the cells that you want to delete data from
but with your large range this way might take some typing. but it does work.

Regards
FSt1

"Joanne" wrote:

> WinXP Pro MSOffice2003
>
> I recorded this macro to clear the contents of my ws before exiting. It
> is attached to a button on the ws. Problem is, it clears my formulas
> from the worksheet.
> What changes do I need to make to get it to clear values and leave
> formulas intact?
>
> Public Sub Clear()
> ' Clear Worksheet values for next invoice
>
> Rows("15:65").Select
> Range("A65").Activate
> Selection.ClearContents
> End Sub
>
> Thanks for the help - you guys are great
> Joanne
>

 
Reply With Quote
 
Joanne
Guest
Posts: n/a
 
      6th Jan 2008
Mike
I now have row A on this ws linked to row c on sheet1
So, the code will not clear contents of row 1 until I clear contents on
sheet1.
My 'Clear' button is on ws 3 and clears it's contents except linked
cells
Can you show me how to reference, in my 'Clear' macro, sheet1 and clear
it's contents before it clears sheet3? Sheet one has not formulas, just
non calc data on it.
Thanks Mike
Joanne


Mike H wrote:

> Joanne,
>
> maybe this
>
> Selection.SpecialCells(xlCellTypeConstants).Select
> Selection.ClearContents
>
> Try it on a non-critical sheet first.
>
> Mike
>
> "Joanne" wrote:
>
> > WinXP Pro MSOffice2003
> >
> > I recorded this macro to clear the contents of my ws before exiting. It
> > is attached to a button on the ws. Problem is, it clears my formulas
> > from the worksheet.
> > What changes do I need to make to get it to clear values and leave
> > formulas intact?
> >
> > Public Sub Clear()
> > ' Clear Worksheet values for next invoice
> >
> > Rows("15:65").Select
> > Range("A65").Activate
> > Selection.ClearContents
> > End Sub
> >
> > Thanks for the help - you guys are great
> > Joanne
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
clear contents re value Curt Microsoft Excel Programming 9 1st Jun 2009 04:02 PM
Clear Contents =?Utf-8?B?U3RldmVk?= Microsoft Excel Programming 4 15th Oct 2007 11:16 PM
Clear Contents =?Utf-8?B?UmljaGFyZA==?= Microsoft Excel Programming 5 11th Sep 2007 01:34 PM
clear contents =?Utf-8?B?QXJuZSBIZWdlZm9ycw==?= Microsoft Excel Programming 1 13th Jun 2007 03:39 PM
Macro to clear range contents when cell contents are changed by us =?Utf-8?B?U3RldmUgRQ==?= Microsoft Excel Programming 12 22nd Feb 2007 09:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:30 PM.