MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old May 3rd, 2002, 04:51 AM   #1
jdeitch
New Member
 
Join Date: Feb 2002
Location: Bloomington, MN
Posts: 16
Default

I have a spreadsheet with "Sales" for Year 1 in B2, Sales for Year 2 in C2, etc. I've also defined a Name for $B$2 (as an absolute reference) because I need to go to it in a Visual Basic Procedure (B2 is named 'SalesY1').

The problem is that the users will put an amount in B2, say 500, and want to increment that amount in subsequent years by a percentage per year. If, in Cell C2, they enter "1.2*" and then click on cell B2 (to indicate that the formula is 1.2 times the value in B2), the formula in C2=1.2*SalesY1. They would like to just copy the equation in C2 to D2 so that D2 =1.2*C2, but because it puts SalesY1 in the formula in C2, and SalesY1 is an absolute reference, the formulas for the subsequent years are all 1.2*SalesY1 (or 600 for each of the subsequent years instead of 600, 720, etc.).

Is there a way to tell Excel to use the cell address rather than the name of the cell?

The only other way I've thought to do it is have the named cell be A2 (maybe named "Sales") and then when I need to go to sales for year 1 in the procedure, I would go to "Sales" and then offset by 1 column. I'll do that unless someone has a better idea.

Thanks in advance for your help.

Jay
jdeitch is offline   Reply With Quote
Old May 3rd, 2002, 08:33 AM   #2
MT_Shanachie
New Member
 
Join Date: Apr 2002
Posts: 48
Default

Quote:
On 2002-05-03 03:51, jdeitch wrote:
I have a spreadsheet with "Sales" for Year 1 in B2, Sales for Year 2 in C2, etc. I've also defined a Name for $B$2 (as an absolute reference) because I need to go to it in a Visual Basic Procedure (B2 is named 'SalesY1').

The problem is that the users will put an amount in B2, say 500, and want to increment that amount in subsequent years by a percentage per year. If, in Cell C2, they enter "1.2*" and then click on cell B2 (to indicate that the formula is 1.2 times the value in B2), the formula in C2=1.2*SalesY1. They would like to just copy the equation in C2 to D2 so that D2 =1.2*C2, but because it puts SalesY1 in the formula in C2, and SalesY1 is an absolute reference, the formulas for the subsequent years are all 1.2*SalesY1 (or 600 for each of the subsequent years instead of 600, 720, etc.).

Is there a way to tell Excel to use the cell address rather than the name of the cell?

The only other way I've thought to do it is have the named cell be A2 (maybe named "Sales") and then when I need to go to sales for year 1 in the procedure, I would go to "Sales" and then offset by 1 column. I'll do that unless someone has a better idea.

Thanks in advance for your help.

Jay
Jay,
I don't have a direct answer for you, but I'm wondering if you might be able to solve your problem by changing your VBA code. Can you explain why you need to have the cell named in order to go to it in the procedure? What are you doing to B2 in the procedure once you go there?
MT_Shanachie is offline   Reply With Quote
Old May 3rd, 2002, 11:08 AM   #3
jdeitch
New Member
 
Join Date: Feb 2002
Location: Bloomington, MN
Posts: 16
Default

Basically the VB code runs through a bunch of scenarios of cost/price/volume (% variance from plan, etc.). To do that it copies the original data to another place, does the sensitivity analysis, then puts the original info back where it found it. To put it back, it copies the data from the temp location then selects the starting cell (which would be like Sales Y1) to paste it.

As I mentioned earlier, I could make the named cell A2 instead of B2 and use "Offset" when I want to return the data. I just thought that I'd see if anyone had a better idea.

Thanks for your help.

Jay
jdeitch is offline   Reply With Quote
Old May 3rd, 2002, 11:33 AM   #4
MT_Shanachie
New Member
 
Join Date: Apr 2002
Posts: 48
Default

Quote:
On 2002-05-03 10:08, jdeitch wrote:
Basically the VB code runs through a bunch of scenarios of cost/price/volume (% variance from plan, etc.). To do that it copies the original data to another place, does the sensitivity analysis, then puts the original info back where it found it. To put it back, it copies the data from the temp location then selects the starting cell (which would be like Sales Y1) to paste it.

As I mentioned earlier, I could make the named cell A2 instead of B2 and use "Offset" when I want to return the data. I just thought that I'd see if anyone had a better idea.

Thanks for your help.

Jay
Jay,
Any reason why you can't just select the cell without naming it? Assuming you want to paste to Cell B2 on Sheet1, you could use something like:

Sheets(1).Activate
Range("B2").Select
ActiveSheet.Paste
MT_Shanachie is offline   Reply With Quote
Old May 3rd, 2002, 04:49 PM   #5
jdeitch
New Member
 
Join Date: Feb 2002
Location: Bloomington, MN
Posts: 16
Default

I prefer to use names for VB so it doesn't break when a row or column is added. This workbook
has several dozen named ranges, thousands of cells and about 30 printed pages of VB. With all that going on, adding a row or column without named ranges would be a real chore.

Thanks,
Jay
jdeitch is offline   Reply With Quote
Old May 3rd, 2002, 04:54 PM   #6
s-o-s
Board Regular
 
s-o-s's Avatar
 
Join Date: Apr 2002
Location: Kissimmee, Florida
Posts: 384
Default

Quote:
On 2002-05-03 03:51, jdeitch wrote:
I have a spreadsheet with "Sales" for Year 1 in B2, Sales for Year 2 in C2, etc. I've also defined a Name for $B$2 (as an absolute reference) because I need to go to it in a Visual Basic Procedure (B2 is named 'SalesY1').

The problem is that the users will put an amount in B2, say 500, and want to increment that amount in subsequent years by a percentage per year. If, in Cell C2, they enter "1.2*" and then click on cell B2 (to indicate that the formula is 1.2 times the value in B2), the formula in C2=1.2*SalesY1. They would like to just copy the equation in C2 to D2 so that D2 =1.2*C2, but because it puts SalesY1 in the formula in C2, and SalesY1 is an absolute reference, the formulas for the subsequent years are all 1.2*SalesY1 (or 600 for each of the subsequent years instead of 600, 720, etc.).

Is there a way to tell Excel to use the cell address rather than the name of the cell?

The only other way I've thought to do it is have the named cell be A2 (maybe named "Sales") and then when I need to go to sales for year 1 in the procedure, I would go to "Sales" and then offset by 1 column. I'll do that unless someone has a better idea.

Thanks in advance for your help.

Jay
Can you change the VB to pickup a value from a specific cell.

Eg Sheet1 cell B2 can be called from any active sheet in a macro by..

Sheets("Sheet1").Range("B2").Value

Instead of picking up a Named Range.

Would this be possible?

__________________
Hope This Helps.
Sean.
Digest of Homes

WinXP, XL XP
s-o-s is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 05:43 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes