For Each-Next Construct Help Please...

Larry

New Member
Joined
Apr 4, 2002
Messages
29
I am attempting to subtotal using a For Each Next Construct; however, I do not know which "element" to use to identify a change in my range.

The syntax is as follows:
For Each element In group
[Instructions]
[Exit For]
[Instructions]
Next [element]

I am wanting a subtotal row for each change in range A8:A65536, but the VBA does not recognize "Change" as a valid element.

Any help will be greatly appreciated.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I aplogize if this is poor board etiquette, but I really need some help with this. So, TTT...
 
Upvote 0
Hi Larry.
I am fairly new with Excel and will try to help you out, but I do not understand exactly what you are trying to do???
Tom
 
Upvote 0
I am attempting to insert custom subtotals after each change in part number that is located in column A. For example:

Part# Qty
55012 15
55012 12
55012 1
55013 5
55013 8
55014 0

I am trying to use the For Each-Next Construct to say for each change in part number, insert a subtotal row. I have written the code for the subtotals, but they are acting as a grand total since they are going directly to the bottom of my data set.
I am using this For/With statement to insert the subtotals for each column I want totaled but I dont know what to use to get this at each change in part number.

With Sheets("Report").Cells(rowcount + 7, 5)
.Formula = "=Sum(E7:E" & rowcount + 6 & ")"
.Font.Bold = True
End With

Hopefully, this will help make my request a little clearer. I am very new to Excel Developing and I'm still unsure of the terminology.

_________________
Thanks,

Larry
This message was edited by Larry on 2002-04-16 07:09
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,938
Members
448,534
Latest member
benefuexx

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