Excel Macro to rearrange data- combine cells and move sheets

Closed
masayaanglibre Posts 1 Registration date Wednesday 16 September 2015 Status Member Last seen 16 September 2015 - 16 Sep 2015 à 16:42
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 21 Sep 2015 à 11:44
Hello,

I am just starting to use macros and am lost on figuring this out. Any help would be appreciated, thanks.


Inventory comes in a 9x9 box with position 1,1 (rows, columns) in the bottom left
I have an inventory spreadsheet I get in that has 4 columns of pertinent info. Column D,G and M all have info I need to combine and place in a cell location based upon column 14. Preferably the data would be formatted to have each of the 3 original cell data on a new line within the new cell.


Sample Input



Sample Output
Related:

1 response

TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 555
21 Sep 2015 à 11:44
Hi Masayaanglibre,

The code below isn't based on the position found in column N. It fills out the first 9 cells of the first row and then moves on to the second row.

See if the code does what you want it to do:

Sub RunMe()
Dim x As Integer

Sheets("Sheet2").Select
With Range("A1:I9")
    .RowHeight = 46.5
    .ColumnWidth = 9.86
    .WrapText = True
End With

x = 1

For Each cell In Range("A1:I9")
    x = x + 1
    cell.Value = Sheets("Sheet1").Range("D" & x).Value & " " & _
    Format(Sheets("Sheet1").Range("G" & x).Value, "d-mmm-yy") & " " & _
    Sheets("Sheet1").Range("M" & x).Value
Next cell

End Sub


Best regards,
Trowa