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