Weeble
Board Regular
- Joined
- Nov 30, 2016
- Messages
- 95
- Office Version
- 365
Hi! I'm need of abit of help here. Prob taken water over my head.
I'm a really green VBA coder. Been trying to google and youtube for solutions to my problem. Right now I am doing this manualy with abit of coding. But was wondering if there might be a fully automated solution to this.
My 'Blad1'(sheet1) contains a table with this information.
<tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151612[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151613[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151511[/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151234[/TD]
[TD="align: center"]6[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151236[/TD]
[TD="align: center"]7[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151612[/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151612[/TD]
[TD="align: center"]9[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151619[/TD]
[TD="align: center"]10[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]163215[/TD]
[TD="align: center"]11[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]132168[/TD]
[TD="align: center"]12[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]133521[/TD]
[TD="align: center"]13[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]132168[/TD]
[TD="align: center"]14[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]132168[/TD]
[TD="align: center"]15[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]132168[/TD]
[TD="align: center"]16[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]132168[/TD]
</tbody>
My 'Blad2'(sheet2) has this information
<tbody>
[TD="align: center"]2[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] "]City :[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] "]Atlantis[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="align: center"]3[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] "]Zone[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] "]OCE[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="align: center"]4[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="align: center"]5[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] "]Unique Barcodes:[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FF0000]#FF0000[/URL] , align: right"]151612[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="align: center"]6[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FF0000]#FF0000[/URL] , align: right"]151613[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="align: center"]7[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FF0000]#FF0000[/URL] , align: right"]151619[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
</tbody>
My goal.
I want to have a VBA For While loop that does the following.
Next step the FOR loop should not have found any more unique values of ZONES with the city Atlantis.
Then it should continue and look for the next unique CITY name in 'Blad1' which is Pluto.
Then continue the previous loop, but with the new unique value of Pluto.
Maybe this became more complicated then I originaly expected.
I'm a really green VBA coder. Been trying to google and youtube for solutions to my problem. Right now I am doing this manualy with abit of coding. But was wondering if there might be a fully automated solution to this.
My 'Blad1'(sheet1) contains a table with this information.
A | B | C | D | E | |
---|---|---|---|---|---|
City | Order | Barcode | Article | zone | |
Atlantis | Crystal | OCE | |||
Atlantis | Boat | OCE | |||
Atlantis | Oars | LAN | |||
Atlantis | Clay statue | CRA | |||
Atlantis | Something | LAN | |||
Atlantis | Facepaint | OCE | |||
Atlantis | Plant | OCE | |||
Atlantis | Ocean | OCE | |||
Pluto | Rock 1 | LAN | |||
Pluto | Rock 2 | LAN | |||
Pluto | Rock 3 | LA1 | |||
Atlantis | Rock 4 | OCE | |||
Pluto | Rock 5 | LAN | |||
Pluto | Rock 6 | LAN | |||
Pluto | Rock 7 | LAN |
<tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151612[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151613[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151511[/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151234[/TD]
[TD="align: center"]6[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151236[/TD]
[TD="align: center"]7[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151612[/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151612[/TD]
[TD="align: center"]9[/TD]
[TD="align: right"]123[/TD]
[TD="align: right"]151619[/TD]
[TD="align: center"]10[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]163215[/TD]
[TD="align: center"]11[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]132168[/TD]
[TD="align: center"]12[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]133521[/TD]
[TD="align: center"]13[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]132168[/TD]
[TD="align: center"]14[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]132168[/TD]
[TD="align: center"]15[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]132168[/TD]
[TD="align: center"]16[/TD]
[TD="align: right"]321[/TD]
[TD="align: right"]132168[/TD]
</tbody>
Blad1
My 'Blad2'(sheet2) has this information
E | F | G | H | |
---|---|---|---|---|
<tbody>
[TD="align: center"]2[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] "]City :[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] "]Atlantis[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="align: center"]3[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] "]Zone[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] "]OCE[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="align: center"]4[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="align: center"]5[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] "]Unique Barcodes:[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FF0000]#FF0000[/URL] , align: right"]151612[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="align: center"]6[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FF0000]#FF0000[/URL] , align: right"]151613[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="align: center"]7[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FF0000]#FF0000[/URL] , align: right"]151619[/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=FFC000]#FFC000[/URL] , align: right"][/TD]
</tbody>
Blad2
My goal.
I want to have a VBA For While loop that does the following.
- From 'Blad1' Copy first unique value in column A into 'Blad2' F2(city).
- Then I want to copy the first unique value from 'Blad1' column E(zone), that matches F2(city) in 'Blad2'F2. into 'Blad2' F3
- I then want to add a line that prints 'Blad2'
- Then I need to check if column E in 'Blad1' has another unique value that matches F2(city) from 'Blad2', If so, copy that next value into 'Blad2' F3
- IF there was a new unique value, print 'Blad2' again.
- City : Atlantis
- Zone: OCE
- Printed
- Printed
- Printed
Next step the FOR loop should not have found any more unique values of ZONES with the city Atlantis.
Then it should continue and look for the next unique CITY name in 'Blad1' which is Pluto.
Then continue the previous loop, but with the new unique value of Pluto.
Maybe this became more complicated then I originaly expected.