VBA to find more than 1 value, copy and paste to anther sheet

amxtomzo

Active Member
Joined
Nov 7, 2009
Messages
312
Hello and thanks for looking
I am trying to loop through a spreadsheet looking in column 3 for DC01, DC02, DC03...ect
and in between the DCXX, in column B, i am also looking for EDITION,
i need to make a list with the DCXX, followed by each instance of EDiTION and the 8 columns of data
listed in between each instance if DCXX

the DCXX goes from DC01 to DC250

i can only find one or the other
i cant seem to start looking for EDITION when i find DCXX,
then stop looking for EDITION when i find the next DCXX
I can only get all of the DCXX listed, Or all of the EDITIONS listed

Thank you very much

it should look like the following when its done, only a much longer list


ABCDEFGH
2DC01






3
EDITION111211
4
EDITION36254640126612504
5DC02






6
EDITION551255
7
EDITION310110
10
8
EDITION427942855655584
9
EDITION56051625123112101
10DC03






11
EDITION2155191643203119
12
EDITION543784518898748

<colgroup> <col style="WIDTH: 30px; FONT-WEIGHT: bold"> <col style="WIDTH: 64px"> <col style="WIDTH: 73px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"></colgroup> <tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Will DC01 or DC02 or any of the DCXX values occur multiple times in the file?
 
Upvote 0
I'm having trouble visualizing what your worksheet would look like. Can you post a screen shot or a link to a share server of post a mock up illustration?
 
Upvote 0
Give me a moment and i will throw something to gether
i tried to paste an image i made with excel Jeenie

i can see it, can you?
 
Upvote 0
here the image ....I hope





ABCDEFGH
3DC01






4
EDITION11121
5
EDITION36254640126612504
6
EDITION55125
7DC02






8
EDITION310110

9
EDITION427942855655584
10
EDITION56051625123112101
11DC03






12
EDITION2155191643203119
13
EDITION543784518898748
14DC04






15
EDITION114551412872905
16
EDITION246174794937
17
EDITION430413256306081
18DC05






19
EDITION15716591171156
20
EDITION24734795943
21
EDITION3842861711682
22
EDITION4885881771765
23
EDITION514251462892845
24DC07






25
EDITION132123871652
26
EDITION1212352
27
EDITION2212352
28
EDITION332462
29
EDITION432462
30
EDITION52073354407
31
EDITION2132313
32
EDITION41121

<colgroup> <col style="WIDTH: 30px; FONT-WEIGHT: bold"> <col style="WIDTH: 64px"> <col style="WIDTH: 73px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"></colgroup> <tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
I think we have a miscommunication. I need to know what your starting worksheet looks like. I understand what you want for results, but my problem is in not knowing where data exists on the source document, so I can write the code to accomodate that data layout. I understand that the DC01-DC250 is in column C and the Editions are in column B. What I don't know is what else might be in those columns and if there are blanks between groupings, etc. I need to be able to tell VBA where to look for the data you want, how to identify it and what to do with it. I assume you want output to sheet 2.
 
Upvote 0
sorry
got put on another project
This is a piece of the starting spreadsheet...
Yes there are Blank Spaces in Column B and C
Yes Sheet 2 is where it should go,
I put a copy part of the spreadsheet in my public dropbox folder
https://www.dropbox.com/sh/4xfy48hriyncymi/AAAvUeE9gOiECHquHiptWGs7a?dl=0

it goes as high as DC07




ABCDEFGHIJ
16
PARMRUNDATEIS:THURSDAYJUNE18,2015
17









18
-----------------------------------------------------BUNDLES------------#NAME?INFORMATION--------------




19
#OF#OFKEYINSTTOTALTOTALBUND
20
PUBLTRUCKBLNKKEYXTRAXTRABUNDDRAWDESCRIPTION
21









22
6501211DIST6611071CARRIERWESTRELAY2
23
6601212DIST6611071SCWESTRELAY4
24
6701221DIST6611077CARRIERWESTRELAY5
25
6801231DIST6611085CARRIERWESTRELAY27
26
6901233DIST6611085NIEWESTRELAY15
27
AMDC01WESTDC6231959112479CARRIER
28
34DEALER20SEPPRED670


29
EDITION11121


30
EDITION362313638126212473

31
EDITION55125


32
102001CENTDC1109CARRCENTRELAY8
33
14002532DIST50361118RACKCENTRELAY16
34
51DEALER20SEPPRED15Circulation1.8
35RCIR8205TRUCKMANI
36LOCATIONSPGF







37
PARMRUNDATEIS:THURSDAYJUNE18,2015
38









39
-----------------------------------------------------BUNDLES------------#NAME?INFORMATION--------------





<colgroup> <col style="WIDTH: 30px; FONT-WEIGHT: bold"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"> <col style="WIDTH: 64px"></colgroup> <tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
 
Upvote 0
That was what I needed to see. On the first look, it appears to be too randomly organized for me to write a simple macro for. I have some other work to do right now, and will take another look later, but don't get your hopes up on this one.
 
Upvote 0

Forum statistics

Threads
1,214,567
Messages
6,120,268
Members
448,953
Latest member
Dutchie_1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top