clear contents

J

Joanne

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
 
M

Mike H

Joanne,

maybe this

Selection.SpecialCells(xlCellTypeConstants).Select
Selection.ClearContents

Try it on a non-critical sheet first.

Mike
 
J

Joanne

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
 
F

FSt1

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
 
J

Joanne

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top