Appending a reference number to a line below

PaulJL

New Member
Joined
Oct 9, 2002
Messages
48
I have to create an import routine for a large set of data from a CSV. The problem is that the information is set out in three sections. Header, Address, item. So the Data can look like this

A1, Header info 1, header info 2, header info 3, ...,
B1, Address info 1, Address info 2, Address info 3, ...,
C1, Item info 1, Qty, Price, nett, Vat, Discount, Total
C1, Item info 2, Qty, Price, nett, Vat, Discount, total
A1, Header info 1, .......................
B1,.......................
C1,.................
C1.................
C1.................

As you can see all invoices have 1 line for the header and 1 line for the Address and then muliple lines for the item info.

I need to be able to copy the unique number assigned to the row A1 and copy it into the rows B1 and the multiple rows C1 and when it finds the next A1 type line to copy the new unique number and copy it in the same manor.

Is this possible.

As there are multiple files of this type is it also possible to automate the process of opening them and saving the new file in one large database or even beter would be to save them in three seperate databases (based on line typ A1,B1,C1) which i can then link based on the unique number as a primary Key.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Is it possible? - Yes.

Is it easy? - No.

I had a similar problem. I actually hired someone to do it at ELance.com . I paid some guy in Czecheslovakia $45. It was well worth it as it saved me countless hours.
 
Upvote 0
unfortunately i don't think i am allowed to give the information to anyone due to confidentiality agreements. I am only begining to learn Access and though while i was learning i could apply this to something our company needs (and maybe earn myself a bigger pay rise). This will probably require a VBA solution and so i am stuck. If anyone knows how to solve even part of the problem it would help my learning.
 
Upvote 0

Forum statistics

Threads
1,221,517
Messages
6,160,264
Members
451,635
Latest member
nithchun

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