Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

how use defined range

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » How to use defined range name in loop

How to use defined range name in loop

ResolvedVersion 2007

Robert has attended:
Excel VBA Intro Intermediate course

How to use defined range name in loop

Hi

I want to use already the defined range name in "For .. Each" loop.
I have a range called " Manufacturer" which contains 4 rows.
I want to create 4 new tabs for each cell from the range " Manufacturer " which will be named after cells from this range.

Thanks

Rob

RE: How to use defined range name in loop

Hi Robert

Thanks for getting in touch. Yes this can be done. You'll need code like this:

Sub RangeNameInLoop()

Dim c As Range
Dim Rng As Range

Set Rng = Range("Manufacturer")

For Each c In Rng

Sheets.Add
ActiveSheet.Name = c.Value

Next

End Sub

It's fairly straightforward, but if you'd like me to clarify any part of it let me know.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: How to use defined range name in loop

hi Gary

Thank you very much now it looks very easy ; ) .

I have noticed that I can receive certificate for my course.
Is it possible to get one as well.

Regards
Rob

RE: How to use defined range name in loop

Hi Rob

Thanks for your reply. Yes that's fine, I'll arrange that for you.

Kind regards

Gary Fenn
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

RE: How to use defined range name in loop

Hi

Thank you

Rob

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Line breaks in a cell

You can control the line breaks for multiple-line headings or labels in your Microsoft Excel worksheet, just like you do in Microsoft Word. Here's how to do it.

Click the cell where you want the label or heading to appear.
Type the first line of information.
Press ALT+ENTER.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.