For Each-Next Construct Help Please...
Find bottlenecks in your Excel workbooks
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: For Each-Next Construct Help Please...

  1. #1
    New Member
    Join Date
    Apr 2002
    Location
    Plano, Texas
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    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.

  2. #2
    New Member
    Join Date
    Apr 2002
    Location
    Plano, Texas
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I aplogize if this is poor board etiquette, but I really need some help with this. So, TTT...



  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    Milwaukee, WI
    Posts
    105
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Please post some sample (condensed) data, so we can give you a hand.

  5. #5
    New Member
    Join Date
    Apr 2002
    Location
    Plano, Texas
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


  6. #6
    New Member
    Join Date
    Apr 2002
    Location
    Plano, Texas
    Posts
    29
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    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 ]

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com