also @ TechSpot: Android 4.0: Tracking Ice Cream Sandwich's Availability on Smartphones

TechSpot

Trying to repeat a VBA Macro on across each column

Discussion in 'Software Apps' started by wca, Feb 8, 2008.

Thread Status:
Not open for further replies.
  1. wca Newcomer, in training

    I have a marco that works perfects to Concatenate (join) all of the cells in Column A. However, I want to seperately join all of the cells in each column. So I wanted to the Concatenate of Column B to go in B1, Column C to go in C1, etc (or until there is no data in a column). I think there is a way to change this into a loop, but I don't know how. Below is the macro I have now. Thank you for any help or advice. Dan

    Sub ConcatenateAll()
    Dim x As String, rng As Range, cel As Range
    With ActiveSheet
    Set rng = .Range("A1:A300")
    For Each cel In rng
    x = x & cel.Value
    Next
    .Range("A1").Value = x
    End With

    End Sub
  2. jobeard TechSpot Ambassador

    The output will need to be in some cell not part of the Concatenation.

    If Concat(Ax:Ax+300) then outputs might appear at
    Ax-1, Ax+301, or ANY other Column than A.

    HOWEVER, such wide columns will be very hard to use.
Thread Status:
Not open for further replies.