+ Reply to Thread
Results 1 to 2 of 2

Arrange raw data

  1. #1
    Registered User
    Join Date
    07-31-2008
    Location
    Denmark
    Posts
    2

    Arrange raw data

    Hi

    How can I fix this problem:

    The "raw" excel sheet looks like this:

    A1:x
    A2:x
    A3:y
    A4:z
    A5:z
    A6:z

    B1:a
    B2:b
    B3:c
    B4:d
    B5:e
    B6:f

    And it have to look like this:

    A1:x
    B2:a[new line]b

    A2:y
    B2:c

    A3:z
    B3:d[new line]e[new line]f

    The numbers of cells who have to be “melted” together will vary widely.

  2. #2
    Registered User
    Join Date
    07-31-2008
    Location
    Denmark
    Posts
    2
    Hm, I tryed this macro:

    Sub Makro2()
    Dim Data As Variant,RW as long
    RW = Range("B65536").End(xlUp).Row
    Data = Range("A1:I" & RW)
    x = 0
    y = ActiveCell.Column
    For I = 2 To UBound(Data)

    If Data(I, 2) = Data(I - 1, 2) Then
    If x = 0 Then x = I - 1
    Data(x, y) = Data(x, y) & vbLf & Data(I, y)
    Data(I, y) = Empty
    Else
    x = 0
    End If
    Next
    Range("A1:I" & RW) = Data
    Range(Cells(1, y), Cells(RW, y)).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    End Sub

    But it come with this error after a random number of cells, it is the same place the error comes when I run the macro without changing the sheet. What can it be?

    The only infomation I have on the error is this:

    Run-time error '1004': Application-defined or object-defined error.
    And it mark this with yellow in the macro:

    Range("A1:I" & RW) = Data

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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