+ Reply to Thread
Results 1 to 7 of 7

Change array to include new cells

  1. #1
    Registered User
    Join Date
    06-02-2009
    Location
    Arlington, VA
    MS-Off Ver
    Excel 2007
    Posts
    80

    Change array to include new cells

    I am having a ton of trouble with this. I am trying to add a single text row in between existing data. I have tried multiple loops to try to place an array into Column G, but I cannot figure it out. Is there some coding that will produce the sort of result below in column G?

    Please Login or Register  to view this content.
    Last edited by nsorden; 08-31-2009 at 02:26 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Change array to include new cells

    You actually need this done IN column G? Or is column G your representation of what you want to happen in column E?

    We want the row inserted when the value in column E changes?

    Is the word "SUMMARY" supposed to be entered, or a SUM() formula for that section? Or "Summary" in column E and a SUM() formula in column F?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Change array to include new cells

    Hi, Try:-
    Please Login or Register  to view this content.
    Regards Mick

  4. #4
    Registered User
    Join Date
    06-02-2009
    Location
    Arlington, VA
    MS-Off Ver
    Excel 2007
    Posts
    80

    Re: Change array to include new cells

    You actually need this done IN column G? Or is column G your representation of what you want to happen in column E?

    We want the row inserted when the value in column E changes?

    Is the word "SUMMARY" supposed to be entered, or a SUM() formula for that section? Or "Summary" in column E and a SUM() formula in column F?
    1)Column G in the post is what I would like to happen IN column G
    2)"Summary" should be entered when value in Column E changes
    3)"Summary" actually entered, not a summation.

  5. #5
    Registered User
    Join Date
    06-02-2009
    Location
    Arlington, VA
    MS-Off Ver
    Excel 2007
    Posts
    80

    Re: Change array to include new cells

    Why column C?


    Sub MG14Aug52
    Dim Last As Integer, Del As Long
    Dim Rng As Range, Dn As Range
    Set Rng = Range(Range("c1"), Range("c" & Rows.Count).End(xlUp))
    For Del = Rng.Count To 2 Step -1
    With Range("c" & Del)
    If Not .Value = .Offset(-1).Value Then
    .Insert
    .Offset(-1).Value = "Summary"
    End If
    End With
    Next Del
    End Sub

  6. #6
    Registered User
    Join Date
    06-02-2009
    Location
    Arlington, VA
    MS-Off Ver
    Excel 2007
    Posts
    80

    Re: Change array to include new cells

    MickG's solution seems to work, but I might have simplified my example a little too much. Each of the letters in the example corresponds to a number, so instead of the code placing a summary in between repeating letters, it needs to be placed in between non-repeating numbers that correspond to the letters. The letters determine the change but should not be placed in between the summaries.
    Something similar to this:
    Please Login or Register  to view this content.

  7. #7
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Change array to include new cells

    Hi, Try this:-
    Please Login or Register  to view this content.
    Regards Mick

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1