Results 1 to 3 of 3

Report Generating from an Unknown Quantity of Data

Threaded View

  1. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Report Generating from an Unknown Quantity of Data

    If you edit your macro that creates the column A listing so that there is a blank space between each data set, this gets really easy. Just change your Offset(1,0) to Offset(2,0) in that code and that should do it.

    Option Explicit
    
    Sub ReformatData()
    'Jerry Beaucaire   (5/12/2010)
    Dim CpyRNG  As Range
    Dim Sctn    As Long
    Dim CpyCol  As Long
    Dim NextRow As Long
    Dim wsRpt   As Worksheet
    Dim wsRaw   As Worksheet
    
    Set wsRaw = Sheets("Raw Results")
    Set wsRpt = Sheets("Report")
    
    wsRpt.Cells.Clear
    Set CpyRNG = wsRaw.Range("A:A").SpecialCells(xlCellTypeConstants)
    CpyCol = 1
    NextRow = 1
    
    For Sctn = 1 To CpyRNG.Areas.Count
        CpyRNG.Areas(Sctn).Copy wsRpt.Cells(NextRow, CpyCol)
        If CpyCol + 2 > 11 Then
            CpyCol = 1
            NextRow = wsRpt.Cells.Find("*", wsRpt.Cells(Rows.Count, Columns.Count), _
                SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 2
        Else
            CpyCol = CpyCol + 2
        End If
    Next Sctn
    
    wsRpt.Columns.AutoFit
    End Sub
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1