LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default copy worksheet with formulas and vba function

hi all

thanks to everyone for their help so far!

i have a vba project in excel that saves several sheets to a new workbook.
thus far i was saving only the values using

<BEGIN VBA CODE
Worksheets(Array("Work Order", "Packing Slip", "Invoice", "Release",
"Shipping", "Master Price List")).Copy

Set wkbk = ActiveWorkbook
For Each sh In wkbk.Worksheets

With sh.UsedRange
.Value = .Value
End With

Next
<END VBA CODE

almost everything seemed to work perfectly, however some cells in the saved
(new) workbook will have #Name? instead of the value of the cell of the
parent worksheet.

the cells that generate the #Name? after being copied have the following
formula in the master sheet cell

<BEGIN EXCEL FORMULA
=IF(ISBLANK(C27),"",chooselotnumber(VLOOKUP(C27,'M aster Price
List'!$B$7:$O$44,10,FALSE)))
<END EXCEL FORMULA

the chooselotnumber function checks to see if there are multiple lot numbers
for the choosen product. if there is only one, it returns that one. o/w it
will prompt the user for which lot number to use.

i would like to change my code to copy the formulas instead of just the
values. (the new workbook will need to be opened and updated, so having the
formulas there is a great help) also, i have a function in the master
workbook that is used in some of the calculations.

how do i modify the above code to copy the formulas, ( .FormulaR1C1 =
..FormulaR1C1 ?) and also copy the function i use to the new workbook?

thanks!

J
 
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
Can't copy formulas in a worksheet Bill B Excel Discussion (Misc queries) 7 September 15th 08 11:15 PM
how do I copy a worksheet with formulas to another workbook? bjmcfp Excel Worksheet Functions 1 July 8th 06 02:36 AM
Copy Worksheet With Formulas Wayne Wengert Excel Discussion (Misc queries) 4 June 14th 06 09:52 PM
copy formulas to different cells in another worksheet jskamm Excel Discussion (Misc queries) 1 August 15th 05 06:32 PM
Range COPY function - how to copy VALUES and not formulas James Cooke Excel Programming 1 August 21st 03 07:04 PM


All times are GMT +1. The time now is 06:27 AM.

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"