Computing.Net > Forums > Programming > Macro - Name ranges

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Macro - Name ranges

Reply to Message Icon

Name: kaseyleigh
Date: November 1, 2004 at 08:53:39 Pacific
OS: Windows 2000
CPU/Ram: 2.80Ghz 504mb RAM
Comment:

How can I write a macro to lookup a value in left column in an Excel sheet and name the range that value ??

Thanks for your help!
K x



Sponsored Link
Ads by Google

Response Number 1
Name: Chi Happens
Date: November 2, 2004 at 11:13:33 Pacific
Reply:

Workbook.Sheets("Sheet1").Cells(1,1).Value is how you get a value for a cell.

More information on what you are trying to do would help. (i am not certain what "name the range that value" means)

Hope This helps.
Chi Happens

"They mostly come at night...mostly"


0

Response Number 2
Name: kaseyleigh
Date: November 3, 2004 at 01:11:53 Pacific
Reply:

Hi Chi

On a monthly basis downloading info which will change in size every month. I am using formulas to look in a named range for specific criteria. Now how would I name these ranges automatically every month.

Left column will contain the data to name the range eg rows 1 to 12 will contain 100, 13 to 18 = 200, 19 to 26 300 so on. Next month might be rows 1 to 18 = 100, 19 to 22 = 200.

Hope you understand what I want to achieve.
Thx again
K


0

Response Number 3
Name: Chi Happens
Date: November 3, 2004 at 06:33:01 Pacific
Reply:

KaseyLeigh,
Ok I am not certain I completely understand but I am using your info to create an example sheet. I will post it here: http://www.evolutionsoftwarellc.com/downloads/for_kasey_leigh/test.xls when I finish it. Download it and let me know if this is what you mean. If not, then email me an example of what you mean.

It is currently 9:32 AM (est) I will try to have the test uploaded by 10:00AM est.

Chi

"They mostly come at night...mostly"


0

Response Number 4
Name: Chi Happens
Date: November 3, 2004 at 06:55:56 Pacific
Reply:

KL,
Okay, it is online. I tested it by selecting OPEN when I clicked on the link and I get an error in the range selector. But when I chose SAVE and then ran it from my computer (instead of within the browser) it works right.

This is what it does:
When you run the macro "RangeSelect" you get a little dialog box asking you to name the range (such as 100 or 200...) then when you click "Get Em" it clears the ranges and then select the range of the records matching the name and colors them green.

The macro only selects A-G but you can easily change that. In addition, it does nothing with the range, just makes it purty.

All the code (with the exception of the macro definition) is contained within the UserForm1 file.

Let me know if this is what you meant or if it is completely off base.

Chi

"They mostly come at night...mostly"


0

Response Number 5
Name: kaseyleigh
Date: November 4, 2004 at 04:49:19 Pacific
Reply:

Chi you're a genius!
You're on the right track but ....
instead of highlighting range with colour name the range "100", "200" so on.
Also could it look down the whole selection eg ctrl + * look at left column for 100, 200 etc and permanently name the ranges. Hope you know what I mean!

Thanks
KL


0

Related Posts

See More



Response Number 6
Name: Chi Happens
Date: November 4, 2004 at 12:44:15 Pacific
Reply:

KL,
I am totally lost with the "NAME THE RANGE" thing. I have to admit I am not an Excel guru, just a VB one lol, so I don't know what that means. Please explain what "NAME THE RANGE "100"" means.

It can look down the whole list so that the numbers do not need to be adjacent...let me make a modification and repost the code.

while i do that, educate me on the "permanently name the ranges" portion.

Thanks,
Chi

"They mostly come at night...mostly"


0

Response Number 7
Name: Chi Happens
Date: November 4, 2004 at 12:54:09 Pacific
Reply:

ok, new test is at http://www.evolutionsoftwarellc.com/downloads/for_kasey_leigh/test2.xls

It eliminates the need for the items to be adjacent.

I am looking up "named ranges" in Excel and should be able to do that..."NAME THE RANGES" thing...let's see...

Chi

"They mostly come at night...mostly"


0

Response Number 8
Name: Chi Happens
Date: November 4, 2004 at 13:50:06 Pacific
Reply:

KL,
Okey Dokey...I think I got it.
Check out "They mostly come at night...mostly"


0

Response Number 9
Name: Chi Happens
Date: November 4, 2004 at 13:51:51 Pacific
Reply:

Oops, i messed up my html...

http://www.evolutionsoftwarellc.com/downloads/for_kasey_leigh/test3.xls

try this one
Chi

"They mostly come at night...mostly"


0

Response Number 10
Name: kaseyleigh
Date: November 5, 2004 at 06:02:25 Pacific
Reply:

Chi you're getting there.
The named range doesn't quite work.

In excel if you select cells then do -
Insert
Name
Define
Names in workbook = _100
Ok
This has now named your selection _100.

Hope that helps you buddy !


0

Response Number 11
Name: Chi Happens
Date: November 9, 2004 at 04:05:44 Pacific
Reply:

it worked for me. if you click ADD RANGE it will add a named range based on what you type into the editbox. then you can use the drop down to the left and click SELECT THIS RANGE to select that named range.

The named ranges are stored with the workbook, so they are there when you open the workbook. Any changes you make you need to resave the workbook.

Chi

"They mostly come at night...mostly"


0

Response Number 12
Name: kaseyleigh
Date: November 12, 2004 at 05:05:14 Pacific
Reply:

Thanks so much for your help x


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Macro - Name ranges

Outlook Macro: Moving Messages www.computing.net/answers/programming/outlook-macro-moving-messages/13880.html

Using VB to rename Excel sheet tabs www.computing.net/answers/programming/using-vb-to-rename-excel-sheet-tabs/6024.html

Automate X and Y range in excel sca www.computing.net/answers/programming/automate-x-and-y-range-in-excel-sca/16318.html