Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm inserting a worksheet, and that worksheet is from a template file. So the code looks like
Set wks = ThisWorkbook.Worksheets.Add(NextSheet, , , "C:\MyTemplate.xlt" This works well except for one thing: formulas in this new sheet that refer to named ranges give a #NAME error. If I click my mouse in the formula editor and press <Enter, magically the formula resolves properly. I've tried using Worksheet.Calculate and Application.Calculate, but they don't make any difference. Is there a way I can force these formulas to calcualate from code I doesn't matter if the range is defined locally to the sheet or globally to the workbook Thanks James |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Untested: Maybe you could do a replace (equal sign with equal sign) as the next
step in your code. jstrater wrote: I'm inserting a worksheet, and that worksheet is from a template file. So the code looks like: Set wks = ThisWorkbook.Worksheets.Add(NextSheet, , , "C:\MyTemplate.xlt") This works well except for one thing: formulas in this new sheet that refer to named ranges give a #NAME error. If I click my mouse in the formula editor and press <Enter, magically the formula resolves properly. I've tried using Worksheet.Calculate and Application.Calculate, but they don't make any difference. Is there a way I can force these formulas to calcualate from code? I doesn't matter if the range is defined locally to the sheet or globally to the workbook. Thanks, James -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this
Application.CalculateFul |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yet another reason to hate Excel 97 - Application.CalculateFull doesn't exist. I'll transfer my project to my other machine and test it on XP, where I see the method does exist, but it doesn't do me any good today for this client. They really have to upgrade soon..
Thanks James |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave
That's a wild and crazy idea, but it sounds like it might work. To optimize I guess I'll have to do a global search/replace on .UsedRange, that would probably be the fastest Thanks James |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've never noticed any delay when I do it manually.
In xl2002, I hit ctrl-a, ctrl-h and type my stuff and hit ok. The only damage that could happen is if you have a cell formatted as text and have a value that begins with =, then excel will try to convert it to a formula. jstrater wrote: Dave, That's a wild and crazy idea, but it sounds like it might work. To optimize I guess I'll have to do a global search/replace on .UsedRange, that would probably be the fastest. Thanks, James -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave
It works just fine. Just to avoid replacing non-formula-starting equal signs I did a select special on formulas in the sheet Thanks James |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Template;insert a page | Excel Discussion (Misc queries) | |||
How do I insert template in new sheet of pre-existing excel file? | Excel Worksheet Functions | |||
Select and Insert one sheet from a multisheet excel template | Excel Discussion (Misc queries) | |||
Insert Rows in Balance Sheet Template | New Users to Excel | |||
Inserting a row in sheet A should Insert a row in sheet B, removing a row in Sheet A should remove the corresponding row in sheet B | Excel Programming |