+ Reply to Thread
Results 1 to 6 of 6

Combining Columns For Printing

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: Combining Columns For Printing

    Hi Adrian,

    Try this:

    Sub Adrian(): Dim wa As Worksheet, ws As Worksheet, r As Long, s As Long, PI As String
    Set wa = ActiveSheet:           For Each ws In Worksheets
                            If ws.name = "Summary" Then GoTo SetSummary
                                    Next
                Worksheets.Add(Before:=Worksheets(1)).name = "Summary"
    SetSummary: Set ws = Sheets("Summary"): ws.Columns(1).ColumnWidth = 36: s = 2
                ws.Columns(1).HorizontalAlignment = xlCenter
    For r = 2 To wa.Range("A" & Rows.Count).End(xlUp).row: PI = Replace(wa.Cells(r, 12), "-", "")
            PI = Left(PI, 3) & "-" & Mid(PI, 4, 3) & "-" & Right(PI, 4)
                    PI = wa.Cells(r, 3) & Chr(10) & _
    wa.Cells(r, 4) & " , " & wa.Cells(r, 5) & " " & wa.Cells(r, 6) & Chr(10) & _
                    wa.Cells(r, 7) & Chr(10) & PI 'wa.Cells(r, 12)
                    ws.Cells(s, 1) = PI: s = s + 1
    Next r
    End Sub
    Directions for running the routine(s) just supplied

    If you haven't used macros before you'll need to go to:
    File- options - trust center -trust center settings - macro settings ,
    the second option down (disable all macros with notification)

    Then - Copy the code to the clipboard

    Open your Workbook

    Press ALT + F11 to open the Visual Basic Editor.

    Select "Module" from the Insert menu

    Type "Option Explicit" then paste the code under it

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name
    Last edited by xladept; 07-03-2015 at 11:41 PM.
    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

+ 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. Combining data in multiple columns(all columns have same length)into one column
    By nzi0001 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 07-24-2014, 11:19 AM
  2. Combining multiple rows from 2 columns into sorted columns depending on 1st columns value
    By Dexamphetamine in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-11-2013, 10:00 AM
  3. Replies: 3
    Last Post: 07-16-2012, 03:24 AM
  4. Replies: 2
    Last Post: 01-19-2011, 06:16 PM
  5. Combining Text from 2 Columns into 1 then Deleting the 2 Columns
    By sleepindogg in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-30-2006, 02:30 PM

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