Uh oh. I think my problem is much deeper then this single line.
I think my problem is my
loop. First of all, I knew that it was hack job way of doing it, because I don't necessarily need to loop until b2000 (you programmers are going to hate me for this). I just went down that far because I knew b2000 would for sure include all of my data. I'm going to be using this macro on many spreadsheets of varying length. This type of loop was also the only way I knew how to set the z to each
cell in the B column counting down one row each time the loop cycles (although I now am seeing that it's not working like I thought it was).
Bascially what I'm trying to do is pull all my
count subtotals from a
sheet and paste it in column B (stating "xxx Count") and C (stating the count value) on a new sheet that this macro is creating. This macro did do this, but the part with the id and id2
variables was supposed to also insert a value into column A of the new sheet, explanation below.
The spreadsheet I'm starting with has this information (this is for work):
(A)Pallet ID Number (B)useless number (C)-part number (D&E)- useless
There is a row for each box of each part, so there are many in a row with the same Pallet ID number and the same part number. There can also be
multiple part numbers per pallet ID number. There are two blank rows after each pallet ID number before the next pallet ID number, so I need to
compare the pallet ID number from the active row to the pallet ID number three rows down, and if it is different, I need to insert a pallet count on the new sheet that the macro creates in column A, counting from 1 to up to 30. I have the original sheet sorted by pallet ID and then by part number and have count subtotals after each part number (eventually I would like the macro to do this automatically as well, but I'm taking one
step at a time here).
This is what I want the new sheet to look like:
(A)Pallet Number (count from 1 to up to 30)
(B)Part Number "Count" (statement)
(C)value of the count subtotal