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 Mar 16th, 2002, 02:58 AM   #1
kwaring
New Member
 
Join Date: Mar 2002
Location: Nanaimo, BC
Posts: 49
Default

The cells I am trying to reference are in a sheet called interface. In this example, i am trying to use values in cells E37 and E39 to reference Ax and Hy where x and y are the respective values of cells E37 and E39 in sheet "Interface"... Why doesn't this work or how can i make it work?

Range("A" & [Interface!$E$37] & ":" & "H" & [Interface!$E$39]).Select

Thanks!
kwaring is offline   Reply With Quote
Old Mar 16th, 2002, 03:30 AM   #2
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

Hi

Try it this way

Range("A" & Sheets("Interface").Range("E37") & ":" _
& "H" & Sheets("Interface").Range("E39")).Select

It will work just so long as you have relavent values in E37 & E39 of the sheet Interface.


Dave Hawley is offline   Reply With Quote
Old Mar 16th, 2002, 03:37 AM   #3
kwaring
New Member
 
Join Date: Mar 2002
Location: Nanaimo, BC
Posts: 49
Default

That still doesn't work
kwaring is offline   Reply With Quote
Old Mar 16th, 2002, 03:39 AM   #4
Tom Urtis
MrExcel MVP
 
Tom Urtis's Avatar
 
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,387
Default

In answer as to why your code does not work, see this link from earlier tonite:
http://www.mrexcel.com/board/viewtop...2503&forum=2&2

In answer to your second question about how to make it work, try this modification of your code. It worked when I tested it:

Sub SelectRangeTakeTwo()
On Error GoTo e
Range("I" & Sheet2.[E37] & ":" & "I" & Sheet2.[E39]).Select
Exit Sub
e:
MsgBox "Place a valid numeral in E37 or E39" _
& vbCrLf & "of your Interface worksheet.", _
48, "Can't determine range"
End Sub

Very important, this will work only if your Interface sheet is VBA worksheet object #2 of your workbook. Press Alt+F11 to get into the Visual Basic Editor, and see the pane on the left entitled Project - VBAProject. If you don't see it, press Ctrl+R.

Then, find your workbook name, in the syntax VBAProject (WorkbookName), double click to open it, and then open the folder titled "Microsoft Excel Objects". My guess is you will a sheet name, in the syntax Sheet#(Interface), where # is the sheet object number for your Interface sheet. If that number is not 2, then modify this code by plugging in whatever number that Interface sheet is.
__________________
Tom Urtis
Microsoft MVP - Excel
Tom Urtis is offline   Reply With Quote
Old Mar 16th, 2002, 03:45 AM   #5
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

kwaring, instead of just saying "It still doesn't work" how about helping us help you by:

1 Telling us the values in the cells E37 and E39

2. Tell us what the error is you are getting.

As I intitially said:

"It will work just so long as you have relavent values in E37 & E39 of the sheet Interface"



_________________
Kind Regards
Dave Hawley
OzGrid Business Applications
Microsoft Excel/VBA Training


[ This Message was edited by: Dave Hawley on 2002-03-16 02:46 ]
Dave Hawley is offline   Reply With Quote
Old Mar 16th, 2002, 03:48 AM   #6
Tom Urtis
MrExcel MVP
 
Tom Urtis's Avatar
 
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,387
Default

Hi Dave, sorry, didn't mean to step on you there; I responded before looking for subsequent posts.
__________________
Tom Urtis
Microsoft MVP - Excel
Tom Urtis is offline   Reply With Quote
Old Mar 16th, 2002, 03:54 AM   #7
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

Hi Tom

No no, not at all! Just very hard to help when the only response you get is "it still doesn't work" Maybe I should just respond with" Well it does for me"

Dave Hawley is offline   Reply With Quote
Old Mar 16th, 2002, 04:03 AM   #8
kwaring
New Member
 
Join Date: Mar 2002
Location: Nanaimo, BC
Posts: 49
Default

That still doesn't work... i checked to make sure my interface sheet is sheet2, it isn't so i changed everything to sheet1 but there is still a problem when trying to run the code. Gives the following error:
Select method of range class failed.
kwaring is offline   Reply With Quote
Old Mar 16th, 2002, 04:05 AM   #9
Tom Urtis
MrExcel MVP
 
Tom Urtis's Avatar
 
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,387
Default

It worked for me, please copy and post your code so we can fix what's ailing it.
__________________
Tom Urtis
Microsoft MVP - Excel
Tom Urtis is offline   Reply With Quote
Old Mar 16th, 2002, 04:06 AM   #10
kwaring
New Member
 
Join Date: Mar 2002
Location: Nanaimo, BC
Posts: 49
Default

lol... sorry about the "it still doesn't work", what can i say, it's very late! anyways i have tried many values for E37 and E39 all integers above 0. thanks for all the help!
kwaring 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 03:55 AM.


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