Excel Macro to rearrange data- combine cells and move sheets

Closed
masayaanglibre Posts 1 Registration date Wednesday September 16, 2015 Status Member Last seen September 16, 2015 - Sep 16, 2015 at 04:42 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Sep 21, 2015 at 11:44 AM
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

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Sep 21, 2015 at 11:44 AM
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
0