Solved

Help with Macro to Multiple Tabs Excel

Posted on 2016-11-02
2
59 Views
Last Modified: 2016-11-03
Hello,

Can someone please help me create a macro that will iterate through a link in excel and create several tabs based on values in the link.  In the attached example, I have placed a data validation list in cell B4 as a drop down.  I want to iterate though the values in the link and create tabs of all the values contained in the link.

Thanks in advance for your help
Report-Out.xlsx
0
Comment
Question by:fb1990
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
Ejgil Hedegaard earned 500 total points
ID: 41871230
Check attached.
Macro in Module1.

Option Explicit

Sub CreateReports()
    Dim wsReport As Worksheet, ws As Worksheet
    Dim ListName As Variant
    Dim i As Integer
    
    Application.ScreenUpdating = False
    
    Set wsReport = Worksheets("Report")
    For Each ListName In [NamedList]
        wsReport.Range("C2") = ListName
        wsReport.Copy After:=Sheets(ThisWorkbook.Sheets.Count)
        i = 0
        For Each ws In ThisWorkbook.Worksheets
            If Left(ws.Name, Len(ListName)) = CStr(ListName) Then
                i = i + 1
            End If
        Next ws
        If i > 0 Then
            ActiveSheet.Name = ListName & " " & CStr(i + 1)
        Else
            ActiveSheet.Name = ListName
        End If
    Next ListName
End Sub

Open in new window

Report-Out.xlsm
0
 
LVL 1

Author Closing Comment

by:fb1990
ID: 41872035
Thank you very much.  It worked as expected...
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question