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

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
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,834
Messages
6,121,876
Members
449,056
Latest member
ruhulaminappu

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