Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Excel Macro - question and assistance

Posted on 2015-01-19
5
Medium Priority
?
66 Views
Last Modified: 2015-02-03
I have a database export that contains about 350 records. (WTC1)  My goal is to write a macro that will parse the data in each of the rows into a separate sheet, which they would have the data set out as it's displayed in the document called "Survey List"

First is it possible to use the marco function to separate 350 rows into 350 worksheets?

If yes, I will need post a follow up question with details. Thank you
Copy-of-WTC-Survey-Field-List---140801.x
WTC1.xlsx
0
Comment
Question by:mcpilot1
[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
5 Comments
 
LVL 46

Expert Comment

by:aikimark
ID: 40558476
Your posted files don't indicate how the data is to be distributed.
0
 
LVL 18

Expert Comment

by:Simon
ID: 40558486
Yes, easily possible to generate a worksheet for each line. Do you want all worksheets in the same workbook?

I believe the maximum number of worksheets is only limited by the available RAM.
0
 
LVL 6

Accepted Solution

by:
Flora earned 2000 total points
ID: 40558967
here is the code ready for ya

Option Explicit

Sub SplitDataNrows()
'Jerry Beaucaire,  2/28/2012
'Split a data sheet by a variable number or rows per sheet, optional titles
Dim N As Long, rw As Long, LR As Long, Titles As Boolean

    If MsgBox("Split the activesheet into smaller sheets?", vbYesNo, _
                "Confirm") = vbNo Then Exit Sub
    N = Application.InputBox("How many rows per sheet?", "N-Rows", 50, Type:=1)
    If N = 0 Then Exit Sub
    If MsgBox("Include the title row1 on each new sheet?", vbYesNo, _
                "Titles?") = vbYes Then Titles = True

    Application.ScreenUpdating = False
    With ActiveSheet
        LR = .Range("A" & .Rows.Count).End(xlUp).Row
        
        For rw = 1 + ---Titles To LR Step N
            Sheets.Add
            If Titles Then
                .Rows(1).Copy Range("A1")
                .Range("A" & rw).Resize(N).EntireRow.Copy Range("A2")
            Else
                .Range("A" & rw).Resize(N).EntireRow.Copy Range("A1")
            End If
            Columns.AutoFit
        Next rw
        
        .Activate
    End With
    Application.ScreenUpdating = True

End Sub

Open in new window

0
 
LVL 6

Expert Comment

by:Flora
ID: 40558968
once you run this code, it will prompt for inputbox and then type 1 and then it will ask if you want to include header row, it is up to you, you could click yes or no and then you will see all separate sheets for each of your rows.
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 40559653
Do you actually need 350 separate sheets?

Could you work with a Report sheet that is formula driven based on an ID (or just row number) input into one column and then the other columns pull data from the source sheet based on that ID?

Thanks
Rob H
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

604 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