Oh well.. revision 2

spcalan

Well-known Member
Joined
Jun 4, 2008
Messages
1,247
Well I built this sweet vba code to take a notepad file.. format,extract data, then do analysis. Works perfect.

What I was told that this 1 file was 1 invoice therefore 1 report.

Well actually the file may contain many invoices.
I can search and find the Page 1 which starts the new invoice, but do I need to start over ( to reduce headaches ), or try to add something to the code to add the invoice # to the extracted data?

Here is the code:

Sub E_Extract()
x = 1
y = 2

Sheets("charge report").Select
'Find Last Row in Column A
lr = Sheets("charge report").Cells(Rows.Count, "A").End(xlUp).Row
'Extracts Product Code / Description / Lot# / Charge Code
Do Until x > lr
Do Until Left(Sheets("charge report").Cells(x, 11), 1) = "Q" Or x > lr
x = x + 1
Loop
Row = x
pcode = (Sheets("charge report").Cells(x, 3))
desc = (Sheets("charge report").Cells(x, 4))
lot# = (Sheets("charge report").Cells(x + 1, 9))
chcode = (Sheets("charge report").Cells(x, 11))


'Paste Extracted Data in "Data" Sheet
Sheets("data").Cells(y, 1) = Row
Sheets("data").Cells(y, 2) = pcode
Sheets("data").Cells(y, 3) = desc
Sheets("data").Cells(y, 4) = lot#
Sheets("data").Cells(y, 5) = chcode

x = x + 1
y = y + 1
Loop
End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
basically the data currently shows:

1 invoice # based on a certain (x,y) location
Product Code
Description
Lot#
ChCode

I need the
Product Code
Description
Lot#
ChCode
( by invoice # ).

So would I add a do loop based on the location of the Page # that starts the new invoice?
 
Upvote 0

Forum statistics

Threads
1,214,938
Messages
6,122,346
Members
449,080
Latest member
Armadillos

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