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 2nd, 2002, 10:47 AM   #1
phiore
New Member
 
Join Date: May 2002
Posts: 11
Default

I have a data file, consisting of departments with an indeterminate number of rows in each department. the upper left of the range is e7. i have a column of range names, starting at row7 column 1. the number of departments and range names are the same quantity.
i want to start at e7, determine the size of the range, and name the range the name in row 7 col 1, move down to the next department, and name it the second name in the list i.e.row8 col1, and so on. i want to keep going til the list of names returns a blank. appreciate any help i can get.

[ This Message was edited by: phiore on 2002-05-02 09:48 ]
phiore is offline   Reply With Quote
Old May 2nd, 2002, 11:00 AM   #2
Juan Pablo González
MrExcel MVP
 
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
Default

I'm not clear with what you're asking, but, you can use:

Range("E7").Name = "Something"

you can determine the last row with data in Column E with

LastRowInE = Range("E65536").End(xlUp).Row

Hope this helps
__________________
Regards,

Juan Pablo González
http://www.juanpg.com
Juan Pablo González is offline   Reply With Quote
Old May 2nd, 2002, 11:06 AM   #3
phiore
New Member
 
Join Date: May 2002
Posts: 11
Default

i can determine the size of each range. i need help with a"do till isempty", taking the names in the designated column and applying them to the range size i have already determined. thanks
phiore is offline   Reply With Quote
Old May 2nd, 2002, 12:51 PM   #4
phiore
New Member
 
Join Date: May 2002
Posts: 11
Default

any ideas, willing to try almost anything. thanks
phiore is offline   Reply With Quote
Old May 2nd, 2002, 12:56 PM   #5
waderw
Board Regular
 
Join Date: Apr 2002
Posts: 85
Default

I am not following what you are asking either.

maybe try this:

range("E7").select
do until activecell = vbnullstring
'use code here to do what you are trying to do
activecell.offsett(1,0).select

loop

this will go through each row until it reaches an empty row
waderw is offline   Reply With Quote
Old May 2nd, 2002, 12:59 PM   #6
phiore
New Member
 
Join Date: May 2002
Posts: 11
Default

i'll try to explain. i have no problem writing a macro that will determine how big each range should be. however after i have determined the coordinates of each range, i want the macro to go to another location, take the name in that list, and range name the range that i have already highlighted. thanks
phiore is offline   Reply With Quote
Old May 2nd, 2002, 01:00 PM   #7
waderw
Board Regular
 
Join Date: Apr 2002
Posts: 85
Default

or you could try:

range("E7").select

to determine last unempty row you could do the opposite of what Juan suggested,depending on how much data you have, and try:

selection.end(xldown).select

this will select the last row in the current column that is not empty(given there are no empty cells separating your dat.

Regards,
waderw is offline   Reply With Quote
Old May 2nd, 2002, 01:03 PM   #8
waderw
Board Regular
 
Join Date: Apr 2002
Posts: 85
Default

to help determine your populated ranges try some of these:

selection.end(xltoright).select
selection.end(xlup).select
selection.end(xldown).select
selection.end(xltoleft).select

or

range(activecell,selection.end(xltoright)).select
waderw is offline   Reply With Quote
Old May 3rd, 2002, 09:53 AM   #9
phiore
New Member
 
Join Date: May 2002
Posts: 11
Default

I HAVE NO PROBLEM IN DETERMINING THE COORDINATES OF EACH RANGE. I NEED HELP IN WRITING A "LOOP" STATEMENT, THAT WILL TAKE A "NAME" THAT EXISTS IN DIFFERENT COLUMN, APPLY IT TO THE RANGE I HAVE DETERMINED, AND RANGE NAME IT AUTOMATICALLY. THEN, DETERMINE THE SECOND RANGE, GET THE "NAME", AND RANGE NAME THAT RANGE. KEEP DOING THIS TILL IVE RUN OUT OF NAMES IN THE COLUMN OF NAMES. THANKS
phiore is offline   Reply With Quote
Old May 3rd, 2002, 07:48 PM   #10
Tom Schreiner
Board Regular
 
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
Default

The "THANKS" at the end of your last post seemed to be oxymoronic at best...

Anyway, here is some code I wrote for someone, maybe you, which searches down column c for a name, places that name in column a, names the range from columns C:S corresponding to the name in c...
Maybe, if your more patient with yourself than you were with Waderw, who seemed to be trying to help you, this code will help you.
THANKS
Tom





Private Sub cmdGetRange_Click()
Dim LastRow, c, n
Dim TrackNames() As Long
Dim ArrayCnt As Integer
LastRow = Range("D1:D" & Range("D65536").End(xlUp).Row).Rows.Count + 1
ArrayCnt = 1
Columns(1).ClearContents
'deletes all names in workbook
For Each n In ActiveWorkbook.Names
n.Delete
Next
For Each c In Range("C12:C" & LastRow)
If c <> "" Then
ReDim Preserve TrackNames(1 To ArrayCnt)
TrackNames(ArrayCnt) = c.Row
ArrayCnt = ArrayCnt + 1
End If
Next
ReDim Preserve TrackNames(1 To UBound(TrackNames) + 1)
TrackNames(UBound(TrackNames)) = LastRow
For ArrayCnt = 1 To UBound(TrackNames) - 1
Range("A" & ArrayCnt + 11) = _
Range("C" & TrackNames(ArrayCnt))
ActiveWorkbook.Names.Add Name:=Range("A" & ArrayCnt + 11), _
RefersToR1C1:="=Sheet1!" & "R" & TrackNames(ArrayCnt) & _
"C" & 3 & ":" & "R" & TrackNames((ArrayCnt) + 1) - 1 & _
"C" & 19
Next
End Sub



[ This Message was edited by: TsTom on 2002-05-03 18:48 ]
Tom Schreiner 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 02:15 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