Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need a macro to copy a field in header down to dtl records

Status
Not open for further replies.

SpaghettiStraps

Programmer
Apr 19, 2002
14
US
hi guys (and gals)

i've got a report that i pull into excel. unfortunately it is an exact duplicate of the actual report -- with headers and detail sections. in the header of each detail section (one detail section for each account number) is the account number. i need that brought down into the detail records.

column b column c column d column e
99-999999-9-99-999
1 10/15/2003 Journal Entry $500.00
2 10/16/2003 Accounts Payable $ 2.50
3 10/17/2003 Journal Entry $ 30.00
4 10/18/2003 Cash Receipt $ 32.50
Account Total $565.00

(and then this repeats for the next account number)

i need it to look like....
99-999999-9-99-9999
1 10/15/2003 99-999999-9-99-999 Journal Entry $500.00
2 10/16/2003 99-999999-9-99-999 Accounts Payable $ 2.50
3 10/17/2003 99-999999-9-99-999 Journal Entry $ 30.00
4 10/18/2003 99-999999-9-99-999 Cash Receipt $ 32.50
Account Total $565.00

...the macro could either look for the words "account total" or for a blank in column c as a way of knowing when to stop copying and to move on to the next detail set which would, i guess be a ##-###-#-##-### in column c.

hope this isn't too complicated.

thanks,
john
 
i've written down the manual steps to do the above -- i just don't know how to transfer it into macro jargon.

step 1: i position the cursor on the first cell that has an account number (Column D)

step 2: i would begin the macro

step 3: macro would Ctrl-C
move down three rows
if cell is not blank
move one column to left (Column C) and Ctrl-V
move down one row
if Column D is not blank then Ctrl-V again
keep going until Column D IS BLANK

if Column D is blank, then
keep moving down until it reach a non-blank cell
this will be the next account number and
the process can start all over again.

when it can go down 10 times with non-blank cells, then it is at the end of the report.


hope this makes things clearer.

i sure wish i had the brains to be a programmer.

thanks,
john
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top