ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Debug Problem (https://www.excelbanter.com/excel-programming/309058-debug-problem.html)

John[_94_]

Debug Problem
 
Clearing worksheets also clears the formulas. So does delete. How can I
clear a worksheets without destroying the formulas in the worksheet.

I run macro, edit it then want to run again but with the worksheets
cleared. When I clear them, I have to reenter all the formulas.

JOhn


Norman Jones

Debug Problem
 
Hi John,

Try:

ActiveSheet.Cells.SpecialCells(xlCellTypeConstants , _
xlNumbers).ClearContents

---
Regards,
Norman



"John" wrote in message
...
Clearing worksheets also clears the formulas. So does delete. How can I
clear a worksheets without destroying the formulas in the worksheet.

I run macro, edit it then want to run again but with the worksheets
cleared. When I clear them, I have to reenter all the formulas.

JOhn




John[_94_]

Debug Problem
 
That works great, thanks. Now, could I change it so that it worked only
on area selected?

Thanks
John

Norman Jones wrote:

Hi John,

Try:

ActiveSheet.Cells.SpecialCells(xlCellTypeConstants , _
xlNumbers).ClearContents

---
Regards,
Norman



"John" wrote in message
...

Clearing worksheets also clears the formulas. So does delete. How can I
clear a worksheets without destroying the formulas in the worksheet.

I run macro, edit it then want to run again but with the worksheets
cleared. When I clear them, I have to reenter all the formulas.

JOhn





--
R-e-t-u-r-n A-d-d-r-e-s-s I-n-s-t-r-u-c-t-i-o-n-s
Change LID to


Norman Jones

Debug Problem
 
Hi John,

Try:


Selection.SpecialCells(xlCellTypeConstants, _
xlNumbers).ClearContent


---
Regards,
Norman



"John" wrote in message
...
That works great, thanks. Now, could I change it so that it worked only on
area selected?

Thanks
John

Norman Jones wrote:

Hi John,

Try:

ActiveSheet.Cells.SpecialCells(xlCellTypeConstants , _
xlNumbers).ClearContents

---
Regards,
Norman



"John" wrote in message
...

Clearing worksheets also clears the formulas. So does delete. How can I
clear a worksheets without destroying the formulas in the worksheet.

I run macro, edit it then want to run again but with the worksheets
cleared. When I clear them, I have to reenter all the formulas.

JOhn





--
R-e-t-u-r-n A-d-d-r-e-s-s I-n-s-t-r-u-c-t-i-o-n-s
Change LID to




Tom Ogilvy

Debug Problem
 
Selection.SpecialCells(xlCellTypeConstants, _
xlNumbers).ClearContents

--
Regards,
Tom Ogilvy

"John" wrote in message
...
That works great, thanks. Now, could I change it so that it worked only
on area selected?

Thanks
John

Norman Jones wrote:

Hi John,

Try:

ActiveSheet.Cells.SpecialCells(xlCellTypeConstants , _
xlNumbers).ClearContents

---
Regards,
Norman



"John" wrote in message
...

Clearing worksheets also clears the formulas. So does delete. How can I
clear a worksheets without destroying the formulas in the worksheet.

I run macro, edit it then want to run again but with the worksheets
cleared. When I clear them, I have to reenter all the formulas.

JOhn





--
R-e-t-u-r-n A-d-d-r-e-s-s I-n-s-t-r-u-c-t-i-o-n-s
Change LID to




John[_94_]

Debug Problem
 
Changed to Selection.Cells.SpecialCells(xlCellTypeConstants, _
xlNumbers).ClearContents

And it works perfectly though I have no idea HOW it works.

Thanks

John

Norman Jones wrote:
Hi John,

Try:


Selection.SpecialCells(xlCellTypeConstants, _
xlNumbers).ClearContent


---
Regards,
Norman



"John" wrote in message
...

That works great, thanks. Now, could I change it so that it worked only on
area selected?

Thanks
John

Norman Jones wrote:


Hi John,

Try:

ActiveSheet.Cells.SpecialCells(xlCellTypeConstants , _
xlNumbers).ClearContents

---
Regards,
Norman



"John" wrote in message
. ..


Clearing worksheets also clears the formulas. So does delete. How can I
clear a worksheets without destroying the formulas in the worksheet.

I run macro, edit it then want to run again but with the worksheets
cleared. When I clear them, I have to reenter all the formulas.

JOhn




--
R-e-t-u-r-n A-d-d-r-e-s-s I-n-s-t-r-u-c-t-i-o-n-s
Change LID to





--
R-e-t-u-r-n A-d-d-r-e-s-s I-n-s-t-r-u-c-t-i-o-n-s
Change
LID to


Norman Jones

Debug Problem
 
Hi John,

The code is the programmatic equivalent of the manual Steps:

Edit | Go To | Special | check Constants | uncheck all but the Numbers
sub-option | OK | hit the delete key

For further information see VBA help on the SpecialCells method.

I'm pleased you picked up the missing "s" !

---
Regards,
Norman



"John" wrote in message
...
Changed to Selection.Cells.SpecialCells(xlCellTypeConstants, _
xlNumbers).ClearContents

And it works perfectly though I have no idea HOW it works.

Thanks

John

Norman Jones wrote:
Hi John,

Try:


Selection.SpecialCells(xlCellTypeConstants, _
xlNumbers).ClearContent


---
Regards,
Norman



"John" wrote in message
...

That works great, thanks. Now, could I change it so that it worked only
on area selected?

Thanks
John

Norman Jones wrote:


Hi John,

Try:

ActiveSheet.Cells.SpecialCells(xlCellTypeConstants , _
xlNumbers).ClearContents

---
Regards,
Norman



"John" wrote in message
.. .


Clearing worksheets also clears the formulas. So does delete. How can I
clear a worksheets without destroying the formulas in the worksheet.

I run macro, edit it then want to run again but with the worksheets
cleared. When I clear them, I have to reenter all the formulas.

JOhn




--
R-e-t-u-r-n A-d-d-r-e-s-s I-n-s-t-r-u-c-t-i-o-n-s
Change LID to





--
R-e-t-u-r-n A-d-d-r-e-s-s I-n-s-t-r-u-c-t-i-o-n-s
Change
LID to





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com