ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   delete some cell formulas and leave others using code (https://www.excelbanter.com/excel-worksheet-functions/73514-delete-some-cell-formulas-leave-others-using-code.html)

john tempest

delete some cell formulas and leave others using code
 
i have the following code which removes al ceel formulas and saves the sheet.
i would like to leave some of the formulas active but not all
can anybody help
thankyou john tempest
Private Sub CommandButton1_Click()
Dim wkbk As Workbook, sh As Worksheet
Worksheets("MANUAL TS").Copy
Set wkbk = ActiveWorkbook
' get rid of all cell formulas
For Each sh In wkbk.Worksheets
With sh.UsedRange
.Value = .Value
'getrid of command button'
ActiveSheet.OLEObjects("CommandButton1").Delete
End With
Next
wkbk.SaveAs "C:\Documents and Settings\Administrator\My
Documents\HOWDENS\TIMESHEET\ " & Sheets("MANUAL TS").Range("B5") & ".xls"
wkbk.Close
End Sub


All times are GMT +1. The time now is 07:48 AM.

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