Change info order

  • Thread starter Thread starter bren
  • Start date Start date
B

bren

Hi,

I need to reverse this info, please!!.

This is the original DATA

A B C D
1 CÓDIGO 74475 74471 74469
2 1010046 2 5
1
3 1010800 0 1
0
4 1010169 5 1 0
5 1011031 4 2
1
6 1010111 0 0 5

And I need this to show up

A B C
D
1 CÓDIGO CANTIDAD LOCAL
2 1010046 2 74475
3 1010169 5 74475
4 1011031 4 74475
5 1010046 5 74471
6 1010800 1 74471
7 1010169 1 74471
8 1011031 2 74471
9 1010046 1 74469
10 1011031 1 74469
11 1010111 5 74469

Is there a way to do this? Notice that cells with 0 are blank cells

Thank you so much for your help
 
Hi,

I need to reverse this info, please!!.

This is the original DATA

            A                  B            C            D
1    CÓDIGO       74475   74471   74469
2    1010046           2           5
1
3    1010800           0           1
0
4    1010169           5           1            0
5    1011031           4           2
1
6    1010111           0           0            5

And I need this to show up

           A                    B               C
D
1   CÓDIGO        CANTIDAD   LOCAL
2   1010046               2           74475
3   1010169               5           74475
4   1011031               4           74475
5   1010046               5           74471
6   1010800               1           74471
7   1010169               1           74471
8   1011031               2           74471
9   1010046               1           74469
10  1011031              1           74469
11  1010111              5           74469

Is there a way to do this? Notice that cells with 0 are blank cells

Thank you so much for your help

Hi Bren.

I have prepared a procedure where the database is located in range
("A1:Dn").
The output is located in columns G:I



Sub BMO()

[g1].Value = "CÓDIGO"
[h1].Value = "CANTIDAD"
[i1].Value = "LOCAL"
[g2].Select
For Each cell In Range([a2], [A65536].End(xlUp))
If cell.Offset(0, 1).Value <> 0 Then
ActiveCell.Value = cell.Value
ActiveCell.Offset(0, 1).Value = cell.Offset(0, 1).Value
ActiveCell.Offset(0, 2).Value = [b1].Value
ActiveCell.Offset(1, 0).Select
End If
If cell.Offset(0, 2).Value <> 0 Then
ActiveCell.Value = cell.Value
ActiveCell.Offset(0, 1).Value = cell.Offset(0, 2).Value
ActiveCell.Offset(0, 2).Value = [c1].Value
ActiveCell.Offset(1, 0).Select
End If
If cell.Offset(0, 3).Value <> 0 Then
ActiveCell.Value = cell.Value
ActiveCell.Offset(0, 1).Value = cell.Offset(0, 3).Value
ActiveCell.Offset(0, 2).Value = [d1].Value
ActiveCell.Offset(1, 0).Select
End If
Next

[G1].CurrentRegion.Sort Key1:=Range("I2"), Order1:=xlAscending,
Key2:=Range( _
"G2"), Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1,
MatchCase _
:=False, Orientation:=xlTopToBottom,
DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
End Sub

Regards,

Benito
Barcelona
 
Back
Top