98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum 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
Resolved · High Priority · Version 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
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
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:New to Excel 2010 - Sparklines!Excel 2010 includes a new feature called Sparklines which are tiny charts that fit into a single cell and plot data in cells from the worksheet. There are a host of formatting and styles that can be applied to them and they are really quite interesting. |