+ Reply to Thread
Results 1 to 12 of 12

Creating a "Double Column" Report

Hybrid View

  1. #1
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Creating a "Double Column" Report

    Thanks for the rep!

    Try this:

    Sub SplitRepSS(): Dim wm As Worksheet, wd As Worksheet
    Dim P, Q, R, c As Integer, n As Integer, u As Long
    Dim k As Integer, e As Integer, d As Integer
    Set wm = Sheets("Master"): Set wd = Sheets("DoubleColumn")
    u = wm.UsedRange.Rows.Count: c = 3: n = 34 'rows on first page
        Do: d = IIf(k = 0, 1, 2 * k * n - 2): e = IIf(k = 0, 1, 1 + k * n)
        P = wm.Cells(d, 1).Resize(n, 4): wd.Cells(e, 1).Resize(n, 4) = P
        Q = wm.Cells(d, 6).Resize(n, 1): wd.Cells(e, 5).Resize(n, 1) = Q
        R = wm.Cells(d, 9).Resize(n, 1): wd.Cells(e, 6).Resize(n, 1) = R
    P = wm.Cells(n + d, 1).Resize(n, 4): wd.Cells(e + c, 8).Resize(n - c, 4) = P
    Q = wm.Cells(n + d, 6).Resize(n, 1): wd.Cells(e + c, 12).Resize(n - c, 1) = Q
    R = wm.Cells(n + d, 9).Resize(n, 1): wd.Cells(e + c, 13).Resize(n - c, 1) = R
                  c = 0: k = k + 1: Loop Until d > u
      wd.Cells(1, 8).Resize(3, 6).Value = wd.Cells(1, 1).Resize(3, 6).Value
    End Sub
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  2. #2
    Forum Contributor
    Join Date
    12-09-2015
    Location
    Virginia, USA
    MS-Off Ver
    Excel 365
    Posts
    129

    Re: Creating a "Double Column" Report

    Perfect! The rows on page variable helps tremendously, too. Thanks!

  3. #3
    Forum Contributor
    Join Date
    12-09-2015
    Location
    Virginia, USA
    MS-Off Ver
    Excel 365
    Posts
    129

    Re: Creating a "Double Column" Report

    Quote Originally Posted by xladept View Post
    Thanks for the rep!

    Try this:

    Sub SplitRepSS(): Dim wm As Worksheet, wd As Worksheet
    Dim P, Q, R, c As Integer, n As Integer, u As Long
    Dim k As Integer, e As Integer, d As Integer
    Set wm = Sheets("Master"): Set wd = Sheets("DoubleColumn")
    u = wm.UsedRange.Rows.Count: c = 3: n = 34 'rows on first page
        Do: d = IIf(k = 0, 1, 2 * k * n - 2): e = IIf(k = 0, 1, 1 + k * n)
        P = wm.Cells(d, 1).Resize(n, 4): wd.Cells(e, 1).Resize(n, 4) = P
        Q = wm.Cells(d, 6).Resize(n, 1): wd.Cells(e, 5).Resize(n, 1) = Q
        R = wm.Cells(d, 9).Resize(n, 1): wd.Cells(e, 6).Resize(n, 1) = R
    P = wm.Cells(n + d, 1).Resize(n, 4): wd.Cells(e + c, 8).Resize(n - c, 4) = P
    Q = wm.Cells(n + d, 6).Resize(n, 1): wd.Cells(e + c, 12).Resize(n - c, 1) = Q
    R = wm.Cells(n + d, 9).Resize(n, 1): wd.Cells(e + c, 13).Resize(n - c, 1) = R
                  c = 0: k = k + 1: Loop Until d > u
      wd.Cells(1, 8).Resize(3, 6).Value = wd.Cells(1, 1).Resize(3, 6).Value
    End Sub


    Hello,

    I wanted to reach back out to you to see if you could help me out with one change I'd like to make this code work even better for me. I have headers that sometimes fall on the very last row of a column and sometimes goes missed when reading the report (i.e. you don't realize a new section of the report started because it's so far down the page). I would like to try to bump this to the next column, by adding a row before it if the header falls on the last line of the page or insert a line at the start of the new column/page that gives the Header text plus "(cont'd)"

    The Header will always start with ";;ColumnHead" so perhaps knowing whether ;;ColumnHead falls on a multiple of 34 (number of rows on first page), insert row.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  2. [SOLVED] How to Add New Worksheet named "Report" and run loop through all the Sheets Except "Report
    By zaska in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-11-2016, 12:51 AM
  3. Replies: 11
    Last Post: 02-24-2016, 03:11 PM
  4. Formula for Creating a "Top Performer" feature on a production report?
    By h2holbro22 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-14-2015, 03:09 PM
  5. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  6. Creating a "report" based on a search
    By tweitzel79 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2013, 04:42 PM
  7. Creating a "report" on results from logical IF's
    By LariRudi in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-10-2012, 01:28 AM

Tags for this Thread

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