#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default Macro help

Hello everybody

Sub CopyToWorkbook()
Dim mypath As String

If [cmpname] = 0 Then
MsgBox ("company name not entered : enter company name")
Exit Sub
End If
Worksheets("form").Select
Worksheets("form").Copy.Values
On Error Resume Next
mypath = "e:\" & [cmpname] & "\"
MkDir mypath
ActiveWorkbook.SaveAs Filename:=mypath & [emp] & ".xls"
ActiveWorkbook.Close
Application.Goto Reference:="ename"
Worksheets("form").PrintPreview
End Sub

The macro copies the "form" sheet to a new workbook and saves it in the
folder and with assigned name. It works well.

The macro copies the sheet keeping the formulae alive. I want to copy the
sheet without formulae. i.e. only values.
How to modify it?
Any suggestions
Regards
Sreedhar



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 185
Default Macro help

Sreedhar

You could add something like the below into your code. This is not very
efficient as it just copies and paste special+Values ALL the cells on the
activesheet and then copies it to a new book. You could improve this by
testing for the dimensions of the data and just copying that for example.

Sub CopySheet()
With ActiveSheet
.Cells.Copy
.Cells.PasteSpecial Paste:=xlPasteValues
.Copy
End With
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.excelusergroup.org
web: www.nickhodge.co.uk





"yshridhar" wrote in message
...
Hello everybody

Sub CopyToWorkbook()
Dim mypath As String

If [cmpname] = 0 Then
MsgBox ("company name not entered : enter company name")
Exit Sub
End If
Worksheets("form").Select
Worksheets("form").Copy.Values
On Error Resume Next
mypath = "e:\" & [cmpname] & "\"
MkDir mypath
ActiveWorkbook.SaveAs Filename:=mypath & [emp] & ".xls"
ActiveWorkbook.Close
Application.Goto Reference:="ename"
Worksheets("form").PrintPreview
End Sub

The macro copies the "form" sheet to a new workbook and saves it in the
folder and with assigned name. It works well.

The macro copies the sheet keeping the formulae alive. I want to copy the
sheet without formulae. i.e. only values.
How to modify it?
Any suggestions
Regards
Sreedhar



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default Macro help

Thanks Nick
With your suggestion i could able to solve the problem.
I add the following to macro
ActiveWorkbook.BreakLink Name:=fpath, Type:=xlExcelLinks

where fpath = filepathand name
Thanks alot
With regards
Sreedhar
"Nick Hodge" wrote:

Sreedhar

You could add something like the below into your code. This is not very
efficient as it just copies and paste special+Values ALL the cells on the
activesheet and then copies it to a new book. You could improve this by
testing for the dimensions of the data and just copying that for example.

Sub CopySheet()
With ActiveSheet
.Cells.Copy
.Cells.PasteSpecial Paste:=xlPasteValues
.Copy
End With
End Sub


--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.excelusergroup.org
web: www.nickhodge.co.uk





"yshridhar" wrote in message
...
Hello everybody

Sub CopyToWorkbook()
Dim mypath As String

If [cmpname] = 0 Then
MsgBox ("company name not entered : enter company name")
Exit Sub
End If
Worksheets("form").Select
Worksheets("form").Copy.Values
On Error Resume Next
mypath = "e:\" & [cmpname] & "\"
MkDir mypath
ActiveWorkbook.SaveAs Filename:=mypath & [emp] & ".xls"
ActiveWorkbook.Close
Application.Goto Reference:="ename"
Worksheets("form").PrintPreview
End Sub

The macro copies the "form" sheet to a new workbook and saves it in the
folder and with assigned name. It works well.

The macro copies the sheet keeping the formulae alive. I want to copy the
sheet without formulae. i.e. only values.
How to modify it?
Any suggestions
Regards
Sreedhar




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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 05:18 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"