Consulting

Results 1 to 3 of 3

Thread: Solved: move data in Excel

  1. #1
    VBAX Newbie
    Joined
    Aug 2008
    Posts
    4
    Location

    Solved: move data in Excel

    Hi,

    Can anyone help me with the following problem? I have data in Excel that are organized in columns of 48 rows each (so column A contains the data in 48 rows, the same goes for column B, C etc etc). But now I need to have my data in one column, so that every 48 cells of each column end up in column A, in the right order (so that A49-A96 contains data from B01-B48, and A97-A144 contains the data from C01-C48 etc).

    Can I somehow solve this with VBA?

    Thanks in advance!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Public Sub Test()
    Dim LastCol As Long
    Dim i As Long

    With ActiveSheet

    LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
    For i = 2 To LastCol

    .Cells(1, i).Resize(48).Cut .Cells((i - 1) * 48 + 1, "A")
    Next i
    End With

    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Newbie
    Joined
    Aug 2008
    Posts
    4
    Location

    Smile

    Thanks very much. This is exactly what I needed!

Posting Permissions

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