Formulas stored as text

sraasch

New Member
Joined
Aug 27, 2011
Messages
6
I'm trying to copy text-formatted cells containing formulas from a "template" sheet to another sheet where the formulas will be calculated.

I'm storing the formulas as text because I've been unable to stop Excel 2010 from corrupting the formulas (it seems to replace some of the formulas with "#Name" text). Changing the cells to text formatting fixes this.

Due to the large number of cells I'm copying and that I want to retain formatting from the template sheet, I'm using Range.copy to copy the formulas.

I've seen and tried a technique that uses TextToColumns after the copy operation, and this seems to work. I'm hoping for a "prettier" solution.

I understand that using the Evaluate macro may help with this, but I'm concerned about speed of operation during the COPY phase as well as the during the calculation.

Thanks for reading.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Welcome to the Board!

I'm storing the formulas as text because I've been unable to stop Excel 2010 from corrupting the formulas (it seems to replace some of the formulas with "#Name" text).
It might be better to address the source of the problem. Formulas which worked prior to Excel 2010 should work in Excel 2010, unless it is a User Defined Function which you have not copied over, or the Formula uses a Function from an Add-In which you have not activated in your new version of Excel.

Can you post one of the formulas that causes this error?
 
Upvote 0
Thanks.

A Sample formula looks like this:

Code:
=IF(Source="Default",Default_Val,UserVal)
Where "Source", "Default_Val", and "UserVal" are names defined in the destination sheet, but not in the template sheet

Excel would often (not always) corrupt the cell containing the formula, leaving "#Name?" in its place.
 
Upvote 0
I haven't worked much with templates, but is it possible to add those named ranges to your templates to avoid the errors?
 
Upvote 0
It's possible, but the templates are intended to be edited by people w/out detailed knowledge of how the guts of the tool work.

So, while addressing the origin of the wierdness would be nice, I don't see a good way of attacking it.
 
Upvote 0
I guess it doesn't make sense to me how you are using this template.

If it is to be used to by people who don't understand the guts of it, and it uses named ranges, but the named ranges aren't in the template, wouldn't the users them have to physically add the named ranges to it to get it work (meaning they would have to know something about it to get it to work)?
 
Upvote 0
The named ranges are present in the template as text fields. The ranges are relative and defined by the VBA to essentially allow the formulas to access the one cell on the row that corresponds to the column.

So, the VBA adds the named ranges based on the text columns. The users don't have to know anything about names, only that they can access a field based on the name for the column.

The user enters text into the template sheet, and the VBA builds the sheet doing the calculations.

Complex, I know, but will work well for this audience.
 
Upvote 0
I don't think it is a good idea to have formulas on your worksheet that reference named ranges before they exist. Here is how I think I would approach this.

If you are naming the ranges via VBA, why not have VBA add the formulas that used these named ranges at run-time too? That should eliminate those errors you are getting because of your formulas referencing named ranges that do not exist as of yet.
 
Upvote 0
I want the user to be able to add the equation (and column headers, coloring, etc) w/out changing the VBA. As I understand your suggestion, the user would have to add the equation to the VBA.
 
Upvote 0
I want the user to be able to add the equation (and column headers, coloring, etc) w/out changing the VBA. As I understand your suggestion, the user would have to add the equation to the VBA.
Now I am totally confused. If it is the user who is adding the equation, and it is not already in the template, then why would it be in there before he adds it, creating these errors you are talking about?

It sounds like there might be a lot going here with this template, and how to use it, that without us understanding exactly how it is supposed to work, makes it very difficult to provide the advice you are looking for.
 
Upvote 0

Forum statistics

Threads
1,224,545
Messages
6,179,432
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top