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 Apr 15th, 2002, 11:07 AM   #1
nehpets12
Board Regular
 
Join Date: Feb 2002
Posts: 422
Default

I have 8 columns B to I in these I have either 1 or 0.5 I need a macro that that goes down to the last entry in any of these columns and selects the entry in I.

I only need to find this data in columns B C G H I

I am setting it up to create a print area A1 to the active cell I hope this is clear.
nehpets12 is offline   Reply With Quote
Old Apr 15th, 2002, 11:14 AM   #2
AJ
Board Regular
 
Join Date: Mar 2002
Location: =ActiveCell.Address
Posts: 478
Default

I think there are quite a few ways of doing this.
One way of getting the last value in Column I would be:

MyValue = Range("I65536").End(xlUp).Value

Alternatively you could mess about with the SpecialCells feature:

LastCol = ActiveSheet.Cells.SpecialCells(xlLastCell).Column
LastRow = ActiveSheet.Cells.SpecialCells(xlLastCell).Row

Specialcells is the equivalent of presing Ctrl+End - it takes you to the last used cell on your sheet.

These help?

Rgds
AJ
AJ is offline   Reply With Quote
Old Apr 15th, 2002, 11:16 AM   #3
Cosmos75
Board Regular
 
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
Default

Quote:
On 2002-04-15 10:07, nehpets12 wrote:
I have 8 columns B to I in these I have either 1 or 0.5 I need a macro that that goes down to the last entry in any of these columns and selects the entry in I.

I only need to find this data in columns B C G H I

I am setting it up to create a print area A1 to the active cell I hope this is clear.
If you you last cell with data in a column was in Column D32 and In Column I it's I10,

This will bring you to I32.

Range("B1").Select
ActiveCell.SpecialCells(xlLastCell).Select

But what if I32 is empty? Or are you only using this to set the print area?

Edit: AJ beat me to it by 2 minutes!

[ This Message was edited by: Cosmos75 on 2002-04-15 10:17 ]
Cosmos75 is offline   Reply With Quote
Old Apr 15th, 2002, 11:24 AM   #4
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

Those codes will not work if there is data in columns past I.

nehpets12: Does your data stop at column I?
Al Chara is offline   Reply With Quote
Old Apr 15th, 2002, 11:26 AM   #5
Cosmos75
Board Regular
 
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
Default

Al Chara,

GOOD POINT! Didn't think to ask that!!
Cosmos75 is offline   Reply With Quote
Old Apr 15th, 2002, 11:29 AM   #6
nehpets12
Board Regular
 
Join Date: Feb 2002
Posts: 422
Default

in columns "d" "e" "f" I have data that goes to the end of the sheet I only need to find the last data in columns "b" "c" "g" "h" "i" and select the active cell in coumn I

nehpets12 is offline   Reply With Quote
Old Apr 15th, 2002, 11:36 AM   #7
Cosmos75
Board Regular
 
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
Default

So you want to find the last row in which a column has data and go to column I regardless of I has any data or not.

Only column B to I have data?

Are you using this ONLY to set the print area?
Cosmos75 is offline   Reply With Quote
Old Apr 15th, 2002, 11:44 AM   #8
nehpets12
Board Regular
 
Join Date: Feb 2002
Posts: 422
Default

I am only trying to set the print area

but the data I want to print is in columns B C G H or I

I need it to go to the last entry in any of these columns and goto column I so can set the print area a1 to activecell

nehpets12 is offline   Reply With Quote
Old Apr 15th, 2002, 11:58 AM   #9
Cosmos75
Board Regular
 
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
Default

Then this'll work to select that range.

Range("A1").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select

WARNING: BUT!!! It won't work if you have any data, formula past coumn I.

[ This Message was edited by: Cosmos75 on 2002-04-15 10:58 ]
Cosmos75 is offline   Reply With Quote
Old Apr 15th, 2002, 11:59 AM   #10
AJ
Board Regular
 
Join Date: Mar 2002
Location: =ActiveCell.Address
Posts: 478
Default

Still not quite sure I get it, but if the last entry in ANY of columns B C G H or I will get us to the row you want, then use

MyValue = Range("I65536").End(xlUp).Value

to find the number of the last row with a value in column I, then:

Range("I" & myValue).Select

to get to where you want in column I?

Or just
Range("I65536").End(xlUp).Select



[ This Message was edited by: AJ on 2002-04-15 11:02 ]
AJ 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 10:54 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