+ Reply to Thread
Results 1 to 2 of 2

MACRO HELP: Append (Alphabetic) columns

Hybrid View

  1. #1
    Registered User
    Join Date
    10-13-2014
    Location
    treatises csecogy
    MS-Off Ver
    2010
    Posts
    4

    MACRO HELP: Append (Alphabetic) columns

    I need help with a MS EXCEL MACRO.

    I have SIX (6) Columns of data that range anywhere from 5,000 to upwards of 25,000 (it fluctuates; therefore, the macro needs to stop once an empty cell is hit).

    The columns are "B, D, E, J, K, W".

    Each column needs to be separated by a "COMMA".

    Appended data needs to be placed in Column "AF"

    NOTE: This is NOT alpha-numeric NOR numerical characters. This is solely WORDS/ALPHABETIC.

    EXAMPLE:
    ABCA (Column B)
    ABCB (Column D)
    ABCC (Column E)
    ABCD (Column J)
    ABCE (Column K)
    ABCF (Column W)

    Needs to become:
    ABCA,ABCB,ABCC,ABCD,ABCE,ABCF

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: MACRO HELP: Append (Alphabetic) columns

    Welcome to the board!
    Sub CombineCols()
    Dim WS As Worksheet
    Dim LR As Long
    Dim A As Long
    Dim I() As Variant
    Dim J() As Variant
    
    Set WS = ActiveSheet
    'Columns B, D, E, J, K, W
    
    With WS
        LR = .Cells(.Rows.Count, "B").End(xlUp).Row
        
        I = .Range("B2:W" & LR)
        ReDim J(LR)
        For A = 1 To UBound(I, 1)
            J(A) = I(A, 1) & "," & I(A, 3) & "," & I(A, 4) & "," & I(A, 10) & "," & I(A, 22)
        Next
        
        .Range("AF1").Resize(LR, 1).Value = WorksheetFunction.Transpose(J)
    End With
    End Sub
    But you really don't need VBA to do this.
    AF2 =IF(B2<>"",B2&","& D2 & ","&E2&","&J2&","&K2&","&W2, "")
    and copy down.
    David
    (*) Reputation points appreciated.

+ 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] alphabetic sorting of 4 columns when one of the columns has 2 rows
    By jnribbit in forum Excel General
    Replies: 10
    Last Post: 08-05-2013, 09:45 PM
  2. Arranging columns by name (non-alphabetic order)
    By mylovelyhorse in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2012, 11:04 AM
  3. [SOLVED] Macro to code the Data set in another sheet to append in columns based on Criteria
    By anchuri_chaitanya in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-10-2012, 11:41 AM
  4. Replies: 7
    Last Post: 09-21-2011, 01:52 AM
  5. Count number of columns and return an Alphabetic character?!
    By Wino in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-29-2009, 07:59 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