Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default using command button instead of edit function

i have compiled a workbook that includes four worksheets. the work book is a
timesheet.when i have entered eveything into the workbook i need to to
seperate sheet11(timesheet) and save it. i do this by Edid/Move or copy
sheet. on the dropdown menu i select new book and i check the box marked
create copy.this works fine and i am able to save the copied sheet.this seems
a long way round.could i do this with a command button and vba code
thakyou john tempest
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default using command button instead of edit function

something like this should work

Dim wkbk As Workbook, sh As Worksheet
' might not need the 'array' - i copied/edited code that i am using currently
Worksheets(Array("Sheet11")).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:\temp\newtimesheet.xls"
wkbk.Close

hth!

J

"john tempest" wrote:

i have compiled a workbook that includes four worksheets. the work book is a
timesheet.when i have entered eveything into the workbook i need to to
seperate sheet11(timesheet) and save it. i do this by Edid/Move or copy
sheet. on the dropdown menu i select new book and i check the box marked
create copy.this works fine and i am able to save the copied sheet.this seems
a long way round.could i do this with a command button and vba code
thakyou john tempest

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default using command button instead of edit function

GIXXER
thankyou your code works perfect, but each timesheet must have an individual
name,with your code each timesheet would be called newtimesheet.in my
workbook i have an array on the entry sheet which by entering a clock number
brings up an indivduals name.could this be incorporated into the code so each
sheet is saved under an indviduals name by an entry on the timesheet
am i getting to complicated for my own good
thankyou john tempest


"Gixxer_J_97" wrote:

something like this should work

Dim wkbk As Workbook, sh As Worksheet
' might not need the 'array' - i copied/edited code that i am using currently
Worksheets(Array("Sheet11")).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:\temp\newtimesheet.xls"
wkbk.Close

hth!

J

"john tempest" wrote:

i have compiled a workbook that includes four worksheets. the work book is a
timesheet.when i have entered eveything into the workbook i need to to
seperate sheet11(timesheet) and save it. i do this by Edid/Move or copy
sheet. on the dropdown menu i select new book and i check the box marked
create copy.this works fine and i am able to save the copied sheet.this seems
a long way round.could i do this with a command button and vba code
thakyou john tempest

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default using command button instead of edit function

wkbk.SaveAs "c:\temp\timesheet - " & sheets("mysheet").range("A1") & ".xls"

this will save it in c:\temp
with the filename 'timesheet - <value in mysheet!A1.xls

hth

J

"john tempest" wrote:

GIXXER
thankyou your code works perfect, but each timesheet must have an individual
name,with your code each timesheet would be called newtimesheet.in my
workbook i have an array on the entry sheet which by entering a clock number
brings up an indivduals name.could this be incorporated into the code so each
sheet is saved under an indviduals name by an entry on the timesheet
am i getting to complicated for my own good
thankyou john tempest


"Gixxer_J_97" wrote:

something like this should work

Dim wkbk As Workbook, sh As Worksheet
' might not need the 'array' - i copied/edited code that i am using currently
Worksheets(Array("Sheet11")).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:\temp\newtimesheet.xls"
wkbk.Close

hth!

J

"john tempest" wrote:

i have compiled a workbook that includes four worksheets. the work book is a
timesheet.when i have entered eveything into the workbook i need to to
seperate sheet11(timesheet) and save it. i do this by Edid/Move or copy
sheet. on the dropdown menu i select new book and i check the box marked
create copy.this works fine and i am able to save the copied sheet.this seems
a long way round.could i do this with a command button and vba code
thakyou john tempest

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default using command button instead of edit function

GIXXER
this is the code i have now used but get runtime error 9
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:\temp\timesheet - " & Sheets("mysheet").Range("ENTRY!C6")
& ".xls"
wkbk.Close

"Gixxer_J_97" wrote:

wkbk.SaveAs "c:\temp\timesheet - " & sheets("mysheet").range("A1") & ".xls"

this will save it in c:\temp
with the filename 'timesheet - <value in mysheet!A1.xls

hth

J

"john tempest" wrote:

GIXXER
thankyou your code works perfect, but each timesheet must have an individual
name,with your code each timesheet would be called newtimesheet.in my
workbook i have an array on the entry sheet which by entering a clock number
brings up an indivduals name.could this be incorporated into the code so each
sheet is saved under an indviduals name by an entry on the timesheet
am i getting to complicated for my own good
thankyou john tempest


"Gixxer_J_97" wrote:

something like this should work

Dim wkbk As Workbook, sh As Worksheet
' might not need the 'array' - i copied/edited code that i am using currently
Worksheets(Array("Sheet11")).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:\temp\newtimesheet.xls"
wkbk.Close

hth!

J

"john tempest" wrote:

i have compiled a workbook that includes four worksheets. the work book is a
timesheet.when i have entered eveything into the workbook i need to to
seperate sheet11(timesheet) and save it. i do this by Edid/Move or copy
sheet. on the dropdown menu i select new book and i check the box marked
create copy.this works fine and i am able to save the copied sheet.this seems
a long way round.could i do this with a command button and vba code
thakyou john tempest



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default using command button instead of edit function

try

wkbk.SaveAs "c:\temp\timesheet - " & Sheets("ENTRY").Range("C6") & ".xls"

(or change "ENTRY" to the name of the correct sheet)


"john tempest" wrote:

GIXXER
this is the code i have now used but get runtime error 9
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:\temp\timesheet - " & Sheets("mysheet").Range("ENTRY!C6")
& ".xls"
wkbk.Close

"Gixxer_J_97" wrote:

wkbk.SaveAs "c:\temp\timesheet - " & sheets("mysheet").range("A1") & ".xls"

this will save it in c:\temp
with the filename 'timesheet - <value in mysheet!A1.xls

hth

J

"john tempest" wrote:

GIXXER
thankyou your code works perfect, but each timesheet must have an individual
name,with your code each timesheet would be called newtimesheet.in my
workbook i have an array on the entry sheet which by entering a clock number
brings up an indivduals name.could this be incorporated into the code so each
sheet is saved under an indviduals name by an entry on the timesheet
am i getting to complicated for my own good
thankyou john tempest


"Gixxer_J_97" wrote:

something like this should work

Dim wkbk As Workbook, sh As Worksheet
' might not need the 'array' - i copied/edited code that i am using currently
Worksheets(Array("Sheet11")).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:\temp\newtimesheet.xls"
wkbk.Close

hth!

J

"john tempest" wrote:

i have compiled a workbook that includes four worksheets. the work book is a
timesheet.when i have entered eveything into the workbook i need to to
seperate sheet11(timesheet) and save it. i do this by Edid/Move or copy
sheet. on the dropdown menu i select new book and i check the box marked
create copy.this works fine and i am able to save the copied sheet.this seems
a long way round.could i do this with a command button and vba code
thakyou john tempest

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default using command button instead of edit function

THANK YOU THE CODE NOW WORKS PERFECTLY. THE CODE I USED WAS:
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:\temp\timesheet - " & Sheets("TIMESHEET").Range("B5") & ".xls"
wkbk.Close
End Sub


"Gixxer_J_97" wrote:

try

wkbk.SaveAs "c:\temp\timesheet - " & Sheets("ENTRY").Range("C6") & ".xls"

(or change "ENTRY" to the name of the correct sheet)


"john tempest" wrote:

GIXXER
this is the code i have now used but get runtime error 9
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:\temp\timesheet - " & Sheets("mysheet").Range("ENTRY!C6")
& ".xls"
wkbk.Close

"Gixxer_J_97" wrote:

wkbk.SaveAs "c:\temp\timesheet - " & sheets("mysheet").range("A1") & ".xls"

this will save it in c:\temp
with the filename 'timesheet - <value in mysheet!A1.xls

hth

J

"john tempest" wrote:

GIXXER
thankyou your code works perfect, but each timesheet must have an individual
name,with your code each timesheet would be called newtimesheet.in my
workbook i have an array on the entry sheet which by entering a clock number
brings up an indivduals name.could this be incorporated into the code so each
sheet is saved under an indviduals name by an entry on the timesheet
am i getting to complicated for my own good
thankyou john tempest


"Gixxer_J_97" wrote:

something like this should work

Dim wkbk As Workbook, sh As Worksheet
' might not need the 'array' - i copied/edited code that i am using currently
Worksheets(Array("Sheet11")).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:\temp\newtimesheet.xls"
wkbk.Close

hth!

J

"john tempest" wrote:

i have compiled a workbook that includes four worksheets. the work book is a
timesheet.when i have entered eveything into the workbook i need to to
seperate sheet11(timesheet) and save it. i do this by Edid/Move or copy
sheet. on the dropdown menu i select new book and i check the box marked
create copy.this works fine and i am able to save the copied sheet.this seems
a long way round.could i do this with a command button and vba code
thakyou john tempest

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default using command button instead of edit function

welcome! but extend your thanks to the real guru's here that taught me how
to do this! =)

J


"john tempest" wrote:

THANK YOU THE CODE NOW WORKS PERFECTLY. THE CODE I USED WAS:
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:\temp\timesheet - " & Sheets("TIMESHEET").Range("B5") & ".xls"
wkbk.Close
End Sub


"Gixxer_J_97" wrote:

try

wkbk.SaveAs "c:\temp\timesheet - " & Sheets("ENTRY").Range("C6") & ".xls"

(or change "ENTRY" to the name of the correct sheet)


"john tempest" wrote:

GIXXER
this is the code i have now used but get runtime error 9
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:\temp\timesheet - " & Sheets("mysheet").Range("ENTRY!C6")
& ".xls"
wkbk.Close

"Gixxer_J_97" wrote:

wkbk.SaveAs "c:\temp\timesheet - " & sheets("mysheet").range("A1") & ".xls"

this will save it in c:\temp
with the filename 'timesheet - <value in mysheet!A1.xls

hth

J

"john tempest" wrote:

GIXXER
thankyou your code works perfect, but each timesheet must have an individual
name,with your code each timesheet would be called newtimesheet.in my
workbook i have an array on the entry sheet which by entering a clock number
brings up an indivduals name.could this be incorporated into the code so each
sheet is saved under an indviduals name by an entry on the timesheet
am i getting to complicated for my own good
thankyou john tempest


"Gixxer_J_97" wrote:

something like this should work

Dim wkbk As Workbook, sh As Worksheet
' might not need the 'array' - i copied/edited code that i am using currently
Worksheets(Array("Sheet11")).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:\temp\newtimesheet.xls"
wkbk.Close

hth!

J

"john tempest" wrote:

i have compiled a workbook that includes four worksheets. the work book is a
timesheet.when i have entered eveything into the workbook i need to to
seperate sheet11(timesheet) and save it. i do this by Edid/Move or copy
sheet. on the dropdown menu i select new book and i check the box marked
create copy.this works fine and i am able to save the copied sheet.this seems
a long way round.could i do this with a command button and vba code
thakyou john tempest

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign a function to a Command Button MUEEN SEHDI[_2_] Excel Worksheet Functions 3 November 1st 09 01:58 PM
Assign Function to a Command Button MUEEN SEHDI Excel Discussion (Misc queries) 1 October 29th 09 11:25 AM
Getting an ActiveX command button to do a spreadsheet function Givvie Excel Worksheet Functions 4 August 28th 07 11:18 AM
Replace "insert function" with "edit formula" button in fourmula b 13brian Excel Discussion (Misc queries) 0 August 24th 05 08:49 PM
Command Button Function - Macro NickH[_2_] Excel Programming 3 January 22nd 04 11:02 AM


All times are GMT +1. The time now is 01:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"