this is the code i am using at the moment
Private Sub CommandButton1_Click()
Dim wkbk As Workbook, sh As Worksheet
Worksheets("TIMESHEET").Copy
Set wkbk = ActiveWorkbook
' get rid of all cell formulas
For Each sh In wkbk.Worksheets
With sh.UsedRange
.Value = .Value
End With
Next
wkbk.SaveAs "C:\Documents and Settings\Administrator\My
Documents\HOWDENS\TIMESHEET\ " & Sheets("TIMESHEET").Range("B5") & ".xls"
wkbk.Close
End Sub
this code removes the functions but the command button is stil functional
but does not do anything.when i save the worksheet i want the command button
to be non functional or if possible disappear altogether. am i asking too much
thankyou john tempest
thank you bob that worked a treat. the only thing is when i inserted it at
the end it cleared my active worksheet and the saved worksheet,so i inserted
it as shown which only removes it from the saved worksheet
thanks again john tempest
Private Sub CommandButton1_Click()
Dim wkbk As Workbook, sh As Worksheet
Worksheets("TIMESHEET").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("TIMESHEET").Range("B5") & ".xls"
wkbk.Close
End Sub
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.