+ Reply to Thread
Results 1 to 18 of 18

Need VBA Macro to insert node_SEQUENCE all the way down

  1. #1
    Registered User
    Join Date
    03-16-2018
    Location
    Austin Texas
    MS-Off Ver
    Office 2016
    Posts
    39

    Need VBA Macro to insert node_SEQUENCE all the way down

    I need VBA Macro to insert consecutive node_SEQUENCE at each change of NODEID or NODENAME.

    The attached file is just a sample of the records. The original file has 41,000 records I have to enter manually.

    Please see attached excel spreadsheet for example.

    Thanks in advance for any assistance.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Need VBA Macro to insert node_SEQUENCE all the way down


    You forgot to attach the expected result …

  3. #3
    Registered User
    Join Date
    03-16-2018
    Location
    Austin Texas
    MS-Off Ver
    Office 2016
    Posts
    39

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    Thanks Marc L!

    Here's the "result" attachment.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  5. #5
    Registered User
    Join Date
    03-16-2018
    Location
    Austin Texas
    MS-Off Ver
    Office 2016
    Posts
    39

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    Marc L the macro is partially working. Please see result_output attachment.

    Thanks

  6. #6
    Registered User
    Join Date
    03-16-2018
    Location
    Austin Texas
    MS-Off Ver
    Office 2016
    Posts
    39

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    stop_SEQUENCE = 1 and node_SEQUENCE = 1 should always match.

    Thanks!

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    Which macro are you referring to?

  8. #8
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Need VBA Macro to insert node_SEQUENCE all the way down


    When I play a game, I like to first know its rules … So what are they for both columns ?!

  9. #9
    Registered User
    Join Date
    03-16-2018
    Location
    Austin Texas
    MS-Off Ver
    Office 2016
    Posts
    39

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    The Excel VBA Macro pasted below is only partially working.

    Please see attached results from macro below. Yellow highlights and comments

    Thanks vbronton

    Try:

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 06-19-2018 at 10:54 AM. Reason: Added Code Tags

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    Why do you want the node sequence for Westgate Mall to match the stop sequence when they don't match for the node names above? Also, why do the node sequences above start at 22 and then begin at 1 for Westgate Mall?

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    My guess
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    03-16-2018
    Location
    Austin Texas
    MS-Off Ver
    Office 2016
    Posts
    39

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    Here's the beforeMacro and afterMacro excel spreadsheets.

    I will let you know if jindon's macro does the job

    Thanks!

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    Must be like this then...
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    03-16-2018
    Location
    Austin Texas
    MS-Off Ver
    Office 2016
    Posts
    39

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    Attached are the results after jindon's macro.

    Still not working.

    Thanks

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    Like this?
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    03-16-2018
    Location
    Austin Texas
    MS-Off Ver
    Office 2016
    Posts
    39

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    Perfect jindon!

    Thanks!

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,523

    Re: Need VBA Macro to insert node_SEQUENCE all the way down

    You are welcome and thanks for the rep.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  18. #18
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Another way …


    My 2 cents according to post #12 attachment (even if it could be achieved with a formula) :

    PHP Code: 
    Sub Demo1()
            
    Dim VWR&
        
    With Sheet1.UsedRange.Columns(12)
                
    = .Value
                W 
    V
            
    For 2 To UBound(V)
                If 
    W(R1) > 1 Then V(R1) = V(11) - (W(R1) > W(11))
            
    Next
               
    .Offset(, 1).Value V
        End With
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !
    Last edited by Marc L; 06-19-2018 at 11:47 AM. Reason: typo …

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Forcing users to choose "Insert Point" when using Macro to insert rows
    By PitBoo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2017, 11:41 AM
  2. Macro insert multiple sheet and insert age band based on numbers
    By saravanan1981 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-01-2017, 01:47 PM
  3. [SOLVED] Macro to insert row if cell(i,1) notequal cell(i,1)+1 and insert certain values in row.
    By mareike in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-16-2013, 03:29 AM
  4. [SOLVED] Macro to copy row, insert below, invert amt, and insert blank row between each new tx
    By raquel1227 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-07-2013, 12:56 PM
  5. Insert blank row, sum and insert page break macro
    By kim5012 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-06-2012, 01:46 AM
  6. Macro: Copy Row and Insert it ; Insert Odd Year
    By buto87 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-25-2012, 08:55 AM
  7. Macro to insert copy and insert formulas only to next blank row
    By bob in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-30-2006, 07:10 AM

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