View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alex[_21_] Alex[_21_] is offline
external usenet poster
 
Posts: 1
Default Copy Paired Info into Diff # of rows

(Previously posted, on April 13 3:45PM, but I am not well
trained in VB and really NEED a precise code for a Macro)

PLease help!!!

I am working on old county out-migration flow datasets.
The datasets are for in-migration into a specific county.
For example, a typical file includes many in-migration
counties.

row
below

C D E F <-column
1 To To From County Name Number
2 St. Co of
3 <Blank cells in row Returns
4 <Blank row
5 30 017 Custer 10
6 30 111 Yellowstone 6
7 30 031 Gallatin 2
8 Same State 8
9 Diff Region 7
10 30 017 County Non-Migrants 13
11 30 019 Daniels 17
12 30 162 Missula 8
13 30 033 King 4
14 30 031 Gallatin 5
15 Same State 2
16 Diff Region 9
17 30 019 County Non-Migrants 16

I want to make a macro that takes the first numbers by the
cell right below a "County Non-Migrants" and copies them
to the next "County Non-Migrants," taking into account
that the number of rows is not constant.
Example of End Result:

A B C D E F
From From To To County Name Number
St. Co St. Co of
<Blank cells in row Returns
<Blank row
30 017 30 017 Custer 10
30 017 30 111 Yellowstone 6
30 017 30 031 Gallatin 2
30 017 Same State 8
30 017 Diff Region 7
30 017 30 017 County Non-Migrants 13
30 019 30 019 Daniels 17
30 019 30 162 Missula 8
30 019 30 033 King 4
30 019 30 031 Gallatin 5
30 019 Same State 2
30 019 Diff Region 9
30 019 30 019 County Non-Migrants 16


The problem I see is that the rows are not constant. How
would you write a complex if statement to take into
account the "county non-migrants" information?

Thanks for your help. (By the way, I have thousands rows
of cells of this type of information for over 10 years
with cells for each county in three states. A lot of work
for a long time if I have to the procedure manually.)