View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
john tempest
 
Posts: n/a
Default 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